pub enum TungsteniteError {
ConnectionClosed,
AlreadyClosed,
Io(Error),
Tls(TlsError),
Capacity(CapacityError),
Protocol(ProtocolError),
WriteBufferFull(Message),
Utf8(String),
AttackAttempt,
Url(UrlError),
Http(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(Message)
Message write buffer is full.
Utf8(String)
UTF coding error.
AttackAttempt
Attack attempt detected.
Url(UrlError)
Invalid URL.
Http(Response<Option<Vec<u8>>>)
HTTP error.
HttpFormat(Error)
HTTP format error.
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
Source§impl From<CapacityError> for Error
impl From<CapacityError> for Error
Source§fn from(source: CapacityError) -> Error
fn from(source: CapacityError) -> Error
Source§impl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
Source§fn from(err: FromUtf8Error) -> Error
fn from(err: FromUtf8Error) -> Error
Source§impl From<InvalidHeaderName> for Error
impl From<InvalidHeaderName> for Error
Source§fn from(err: InvalidHeaderName) -> Error
fn from(err: InvalidHeaderName) -> Error
Source§impl From<InvalidHeaderValue> for Error
impl From<InvalidHeaderValue> for Error
Source§fn from(err: InvalidHeaderValue) -> Error
fn from(err: InvalidHeaderValue) -> Error
Source§impl From<InvalidStatusCode> for Error
impl From<InvalidStatusCode> for Error
Source§fn from(err: InvalidStatusCode) -> Error
fn from(err: InvalidStatusCode) -> Error
Source§impl From<InvalidUri> for Error
impl From<InvalidUri> for Error
Source§fn from(err: InvalidUri) -> Error
fn from(err: InvalidUri) -> Error
Source§impl From<ProtocolError> for Error
impl From<ProtocolError> for Error
Source§fn from(source: ProtocolError) -> Error
fn from(source: ProtocolError) -> Error
Source§impl From<ToStrError> for Error
impl From<ToStrError> for Error
Source§fn from(err: ToStrError) -> Error
fn from(err: ToStrError) -> Error
Source§impl NonBlockingError for Error
impl NonBlockingError for Error
Source§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§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more