Enum trillium_websockets::Error [−]
pub enum Error { ConnectionClosed, AlreadyClosed, Io(Error), Tls(TlsError), Capacity(CapacityError), Protocol(ProtocolError), SendQueueFull(Message), Utf8, Url(UrlError), Http(Response<Option<String>>), HttpFormat(Error), }
Expand description
Possible WebSocket errors.
Variants
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.
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 error.
Note that this error variant is enabled unconditionally even if no TLS feature is enabled, to provide a feature-agnostic API surface.
- When reading: buffer capacity exhausted.
- When writing: your message is bigger than the configured max message size (64MB by default).
Protocol violation.
SendQueueFull(Message)
Message send queue full.
UTF coding error.
Invalid URL.
HTTP error.
HttpFormat(Error)
HTTP format error.
Trait Implementations
impl From<FromUtf8Error> for Error
impl From<FromUtf8Error> for Error
pub fn from(FromUtf8Error) -> Error
pub fn from(FromUtf8Error) -> Error
Performs the conversion.
impl From<InvalidHeaderName> for Error
impl From<InvalidHeaderName> for Error
pub fn from(err: InvalidHeaderName) -> Error
pub fn from(err: InvalidHeaderName) -> Error
Performs the conversion.
impl From<InvalidHeaderValue> for Error
impl From<InvalidHeaderValue> for Error
pub fn from(err: InvalidHeaderValue) -> Error
pub fn from(err: InvalidHeaderValue) -> Error
Performs the conversion.
impl From<InvalidStatusCode> for Error
impl From<InvalidStatusCode> for Error
pub fn from(err: InvalidStatusCode) -> Error
pub fn from(err: InvalidStatusCode) -> Error
Performs the conversion.
impl From<InvalidUri> for Error
impl From<InvalidUri> for Error
pub fn from(err: InvalidUri) -> Error
pub fn from(err: InvalidUri) -> Error
Performs the conversion.
impl From<ToStrError> for Error
impl From<ToStrError> for Error
pub fn from(ToStrError) -> Error
pub fn from(ToStrError) -> Error
Performs the conversion.
impl NonBlockingError for Error
impl NonBlockingError for Error
pub fn into_non_blocking(self) -> Option<Error>
pub fn into_non_blocking(self) -> Option<Error>
Convert WouldBlock to None and don’t touch other errors.
Auto Trait Implementations
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error