-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(networking): stop using
Box<dyn Error>
(#657)
- Loading branch information
1 parent
c5d590b
commit 89f298a
Showing
12 changed files
with
506 additions
and
309 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#[derive(Debug, thiserror::Error)] | ||
pub enum Error { | ||
#[error("Network error: {0}")] | ||
NetworkError(String), | ||
|
||
#[error("Channel error: {0}")] | ||
ChannelError(String), | ||
|
||
#[error("Gossip error: {0}")] | ||
GossipError(String), | ||
|
||
#[error("Messaging error: {0}")] | ||
MessagingError(String), | ||
|
||
#[error("Round based error: {0}")] | ||
RoundBasedError(String), | ||
|
||
#[error("Serde JSON error: {0}")] | ||
SerdeJson(#[from] serde_json::Error), | ||
|
||
#[error("Connection error: {0}")] | ||
ConnectionError(String), | ||
|
||
#[error("Protocol error: {0}")] | ||
ProtocolError(String), | ||
|
||
#[error("Attempted to start a network with too many topics: {0}")] | ||
TooManyTopics(usize), | ||
#[error("All topics must be unique")] | ||
DuplicateTopics, | ||
|
||
#[error("No network found")] | ||
NoNetworkFound, | ||
|
||
#[error("Other error: {0}")] | ||
Other(String), | ||
|
||
// std compat | ||
#[error(transparent)] | ||
Io(#[from] std::io::Error), | ||
|
||
// libp2p compat | ||
#[error(transparent)] | ||
Dial(#[from] libp2p::swarm::DialError), | ||
#[error(transparent)] | ||
Noise(#[from] libp2p::noise::Error), | ||
#[error(transparent)] | ||
Behaviour(#[from] libp2p::BehaviourBuilderError), | ||
#[error(transparent)] | ||
Subscription(#[from] libp2p::gossipsub::SubscriptionError), | ||
#[error(transparent)] | ||
TransportIo(#[from] libp2p::TransportError<std::io::Error>), | ||
#[error(transparent)] | ||
Multiaddr(#[from] libp2p::multiaddr::Error), | ||
} |
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
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