Skip to content

Commit 78e6f08

Browse files
authored
fix(libp2p): expose builder phase error
May close #4829 and #4824. Export three error types `BehaviourError`, `TransportError`, `WebsocketError` with rename. Feature gated `WebsocketError`. Exported at crate root as [suggested](#4824 (comment)). Pull-Request: #5726.
1 parent 1c3e820 commit 78e6f08

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

libp2p/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
- Deprecate `void` crate.
44
See [PR 5676](https://github.com/libp2p/rust-libp2p/pull/5676).
55

6+
- Expose swarm builder phase errors.
7+
See [PR 5726](https://github.com/libp2p/rust-libp2p/pull/5726).
8+
69
## 0.54.1
710

811
- Update individual crates.

libp2p/src/builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ mod phase;
44
mod select_muxer;
55
mod select_security;
66

7+
#[cfg(all(not(target_arch = "wasm32"), feature = "websocket"))]
8+
pub use phase::WebsocketError;
9+
pub use phase::{BehaviourError, TransportError};
10+
711
/// Build a [`Swarm`](libp2p_swarm::Swarm) by combining an identity, a set of
812
/// [`Transport`](libp2p_core::Transport)s and a
913
/// [`NetworkBehaviour`](libp2p_swarm::NetworkBehaviour).

libp2p/src/builder/phase.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ use swarm::*;
2929
use tcp::*;
3030
use websocket::*;
3131

32+
pub use behaviour::BehaviourError;
33+
pub use other_transport::TransportError;
34+
#[cfg(all(not(target_arch = "wasm32"), feature = "websocket"))]
35+
pub use websocket::WebsocketError;
36+
3237
use super::{
3338
select_muxer::SelectMuxerUpgrade, select_security::SelectSecurityUpgrade, SwarmBuilder,
3439
};

libp2p/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,17 @@ pub mod bandwidth;
148148
#[cfg(doc)]
149149
pub mod tutorials;
150150

151+
#[cfg(all(not(target_arch = "wasm32"), feature = "websocket"))]
152+
pub use builder::WebsocketError as WebsocketBuilderError;
151153
pub use libp2p_identity as identity;
152154
pub use libp2p_identity::PeerId;
153155
pub use libp2p_swarm::{Stream, StreamProtocol};
154156

155157
pub use self::{
156-
builder::SwarmBuilder,
158+
builder::{
159+
BehaviourError as BehaviourBuilderError, SwarmBuilder,
160+
TransportError as TransportBuilderError,
161+
},
157162
core::{
158163
transport::TransportError,
159164
upgrade::{InboundUpgrade, OutboundUpgrade},

0 commit comments

Comments
 (0)