-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Emilia Hane <[email protected]>
- Loading branch information
Showing
12 changed files
with
703 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
//! Error types for stream variants | ||
mod eth; | ||
mod muxdemux; | ||
mod p2p; | ||
|
||
pub use eth::*; | ||
pub use muxdemux::*; | ||
pub use p2p::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use thiserror::Error; | ||
|
||
use crate::capability::{SharedCapabilityError, UnsupportedCapabilityError}; | ||
|
||
use super::P2PStreamError; | ||
|
||
/// Errors thrown by de-/muxing. | ||
#[derive(Error, Debug)] | ||
pub enum MuxDemuxError { | ||
/// Error of the underlying P2P connection. | ||
#[error(transparent)] | ||
P2PStreamError(#[from] P2PStreamError), | ||
/// Stream is in use by secondary stream impeding disconnect. | ||
#[error("secondary streams are still running")] | ||
StreamInUse, | ||
/// Stream has already been set up for this capability stream type. | ||
#[error("stream already init for stream type")] | ||
StreamAlreadyExists, | ||
/// Capability stream type is not shared with peer on underlying p2p connection. | ||
#[error("stream type is not shared on this p2p connection")] | ||
CapabilityNotShared, | ||
/// Capability stream type has not been configured in [`crate::muxdemux::MuxDemuxer`]. | ||
#[error("stream type is not configured")] | ||
CapabilityNotConfigured, | ||
/// Capability stream type has not been configured for | ||
/// [`crate::capability::SharedCapabilities`] type. | ||
#[error("stream type is not recognized")] | ||
CapabilityNotRecognized, | ||
/// Message ID is out of range. | ||
#[error("message id out of range, {0}")] | ||
MessageIdOutOfRange(u8), | ||
/// Demux channel failed. | ||
#[error("sending demuxed bytes to secondary stream failed")] | ||
SendIngressBytesFailed, | ||
/// Mux channel failed. | ||
#[error("sending bytes from secondary stream to mux failed")] | ||
SendEgressBytesFailed, | ||
/// Attempt to disconnect the p2p stream via a stream clone. | ||
#[error("secondary stream cannot disconnect p2p stream")] | ||
CannotDisconnectP2PStream, | ||
/// Shared capability error. | ||
#[error(transparent)] | ||
SharedCapabilityError(#[from] SharedCapabilityError), | ||
/// Capability not supported on the p2p connection. | ||
#[error(transparent)] | ||
UnsupportedCapabilityError(#[from] UnsupportedCapabilityError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.