Enum Error
enum Error
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
ConnectionClosedcauses 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(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(crate::protocol::Message) Message write buffer is full.
-
Utf8 UTF coding error.
-
AttackAttempt Attack attempt detected.
-
Url(UrlError) Invalid URL.
-
Http(http::Response<Option<Vec<u8>>>) HTTP error.
-
HttpFormat(http::Error) HTTP format error.
Implementations
impl Debug for Error
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Display for Error
fn fmt(self: &Self, __formatter: &mut Formatter<'_>) -> Result
impl Error for Error
fn source(self: &Self) -> Option<&dyn Error + 'static>
impl Freeze for Error
impl From for Error
fn from(source: Error) -> Self
impl From for Error
fn from(_: Utf8Error) -> Self
impl From for Error
fn from(_: ToStrError) -> Self
impl From for Error
fn from(source: UrlError) -> Self
impl From for Error
fn from(source: ProtocolError) -> Self
impl From for Error
fn from(_: FromUtf8Error) -> Self
impl From for Error
fn from(err: InvalidUri) -> Self
impl From for Error
fn from(source: CapacityError) -> Self
impl From for Error
fn from(err: InvalidHeaderValue) -> Self
impl From for Error
fn from(err: InvalidStatusCode) -> Self
impl From for Error
fn from(source: TlsError) -> Self
impl From for Error
fn from(source: Error) -> Self
impl From for Error
fn from(err: InvalidHeaderName) -> Self
impl From for Error
fn from(err: Error) -> Self
impl NonBlockingError for Error
fn into_non_blocking(self: Self) -> Option<Self>
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
impl<T> Any for Error
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Error
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Error
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for Error
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Same for Error
impl<T> ToString for Error
fn to_string(self: &Self) -> String
impl<T, U> Into for Error
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Error
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Error
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip for Error
fn vzip(self: Self) -> V