Enum Error
pub enum Error {
ConnectionClosed,
AlreadyClosed,
Io(Error),
Tls(TlsError),
Capacity(CapacityError),
Protocol(ProtocolError),
WriteBufferFull(Box<Message>),
Utf8(String),
AttackAttempt,
Url(UrlError),
Http(Box<Response<Option<Vec<u8>>>>),
HttpFormat(Error),
}Expand description
Possible WebSocket errors.
Variants§
ConnectionClosed
WebSocket connection closed normally. This informs you of the close. It’s not an error as such and nothing wrong happened.
This is returned as soon as the close handshake is finished (we have both sent and received a close frame) on the server end and as soon as the server has closed the underlying connection if this endpoint is a client.
Thus when you receive this, it is safe to drop the underlying connection.
Receiving this error means that the WebSocket object is not usable anymore and the only meaningful action with it is dropping it.
AlreadyClosed
Trying to work with already closed connection.
Trying to read or write after receiving ConnectionClosed causes this.
As opposed to ConnectionClosed, this indicates your code tries to operate on the
connection when it really shouldn’t anymore, so this really indicates a programmer
error on your part.
Io(Error)
Input-output error. Apart from WouldBlock, these are generally errors with the underlying connection and you should probably consider them fatal.
Tls(TlsError)
TLS error.
Note that this error variant is enabled unconditionally even if no TLS feature is enabled, to provide a feature-agnostic API surface.
Capacity(CapacityError)
- When reading: buffer capacity exhausted.
- When writing: your message is bigger than the configured max message size (64MB by default).
Protocol(ProtocolError)
Protocol violation.
WriteBufferFull(Box<Message>)
Message write buffer is full.
Utf8(String)
UTF coding error.
AttackAttempt
Attack attempt detected.
Url(UrlError)
Invalid URL.
Http(Box<Response<Option<Vec<u8>>>>)
HTTP error.
HttpFormat(Error)
HTTP format error.
Trait Implementations§
§impl Error for Error
impl Error for Error
§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
§impl From<CapacityError> for Error
impl From<CapacityError> for Error
§fn from(source: CapacityError) -> Error
fn from(source: CapacityError) -> Error
§impl<Role> From<Error> for HandshakeError<Role>where
Role: HandshakeRole,
impl<Role> From<Error> for HandshakeError<Role>where
Role: HandshakeRole,
§fn from(err: Error) -> HandshakeError<Role>
fn from(err: Error) -> HandshakeError<Role>
§impl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
§fn from(err: FromUtf8Error) -> Error
fn from(err: FromUtf8Error) -> Error
§impl From<InvalidHeaderName> for Error
impl From<InvalidHeaderName> for Error
§fn from(err: InvalidHeaderName) -> Error
fn from(err: InvalidHeaderName) -> Error
§impl From<InvalidHeaderValue> for Error
impl From<InvalidHeaderValue> for Error
§fn from(err: InvalidHeaderValue) -> Error
fn from(err: InvalidHeaderValue) -> Error
§impl From<InvalidStatusCode> for Error
impl From<InvalidStatusCode> for Error
§fn from(err: InvalidStatusCode) -> Error
fn from(err: InvalidStatusCode) -> Error
§impl From<InvalidUri> for Error
impl From<InvalidUri> for Error
§fn from(err: InvalidUri) -> Error
fn from(err: InvalidUri) -> Error
§impl From<ProtocolError> for Error
impl From<ProtocolError> for Error
§fn from(source: ProtocolError) -> Error
fn from(source: ProtocolError) -> Error
§impl From<ToStrError> for Error
impl From<ToStrError> for Error
§fn from(err: ToStrError) -> Error
fn from(err: ToStrError) -> Error
§impl NonBlockingError for Error
impl NonBlockingError for Error
§fn into_non_blocking(self) -> Option<Error>
fn into_non_blocking(self) -> Option<Error>
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
§impl<T> AsErrorSource for Twhere
T: Error + 'static,
impl<T> AsErrorSource for Twhere
T: Error + 'static,
§fn as_error_source(&self) -> &(dyn Error + 'static)
fn as_error_source(&self) -> &(dyn Error + 'static)
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
impl<E> InstrumentError for Ewhere
TracedError<E>: From<E>,
§type Instrumented = TracedError<E>
type Instrumented = TracedError<E>
§fn in_current_span(self) -> <E as InstrumentError>::Instrumented
fn in_current_span(self) -> <E as InstrumentError>::Instrumented
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.