#[non_exhaustive]pub enum Error {
Show 14 variants
InvalidUrl(ParseError),
Engine(Error),
Protocol(Error),
ConnectTimeout(Duration),
#[non_exhaustive] ConnectRejected {
message: String,
data: Option<Value>,
},
IncompatibleServer,
InvalidAuth(&'static str),
NotConnected,
Closed,
AckTimeout(Duration),
Disconnected,
ReservedEvent(String),
Json(Arc<Error>),
InvalidHeader(String),
}Expand description
Everything that can go wrong in the socket.io client.
Typed so callers never have to match on message text. Messages say what happened and what to check; they never contain query values (tokens) of the server URL.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidUrl(ParseError)
The server URL does not parse.
Engine(Error)
The engine.io layer failed: connection refused, DNS, TLS, HTTP status, websocket,
handshake, ping timeout. engineio::Error has the details.
Protocol(Error)
The server sent a packet that breaks the socket.io protocol.
ConnectTimeout(Duration)
The connect attempt (engine.io handshake, upgrade and namespace CONNECT) took longer
than the builder’s timeout.
#[non_exhaustive]ConnectRejected
The server refused the namespace (CONNECT_ERROR): a middleware rejected the auth, or the
namespace does not exist. socket.io-client’s connect_error with err.message /
err.data. The client does not reconnect after this.
Fields
This variant is marked as non-exhaustive
IncompatibleServer
The server answered CONNECT without a session id: a Socket.IO v2 server, which this v3+/v4 client cannot talk to.
InvalidAuth(&'static str)
The auth payload is not a JSON object (socket.io requires one), or auth_with panicked.
NotConnected
emit while not connected, without buffer_while_disconnected.
Closed
The client was closed (disconnect(), a rejection, reconnect attempts exhausted).
AckTimeout(Duration)
No ack within the timeout given to emit_with_ack.
Disconnected
The connection was lost while an ack was pending.
ReservedEvent(String)
The event name is reserved (connect, connect_error, disconnect, disconnecting,
newListener, removeListener): socket.io-client throws on these too.
Json(Arc<Error>)
A value could not be converted to or from JSON.
InvalidHeader(String)
A header name or value is not valid HTTP.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()