Skip to main content

libp2p_wasi_sockets/
error.rs

1use libp2p_core::multiaddr::Multiaddr;
2use libp2p_core::transport::ListenerId;
3
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    #[error("unsupported multiaddr: {0}")]
7    UnsupportedMultiaddr(Multiaddr),
8
9    #[error("invalid multiaddr: {0}")]
10    InvalidMultiaddr(String),
11
12    #[error("listener {0:?} not found")]
13    UnknownListener(ListenerId),
14
15    #[error("i/o error: {0}")]
16    Io(#[from] std::io::Error),
17
18    /// The WASI host's network policy denied the connection.
19    ///
20    /// Under Wasmtime, pass `-S inherit-network` (or `--wasi inherit-network`)
21    /// to grant the component access to the host network.
22    #[error("network capability denied by host (did you pass -S inherit-network to wasmtime?)")]
23    AccessDenied,
24}