Skip to main content

ProtocolError

Trait ProtocolError 

Source
pub trait ProtocolError:
    Error
    + Send
    + Sync
    + 'static {
    // Provided methods
    fn can_continue(&self) -> bool { ... }
    fn boxed(self) -> Box<dyn ProtocolError>
       where Self: Sized { ... }
}
Expand description

Protocol-defined error. Each protocol owns its own concrete error type.

can_continue is the policy hook: when a chain returns Err(boxed), the protocol’s handle/send decides whether the channel survives. The framework never interprets this flag itself.

Provided Methods§

Source

fn can_continue(&self) -> bool

Source

fn boxed(self) -> Box<dyn ProtocolError>
where Self: Sized,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ProtocolError for HttpError

Source§

fn can_continue(&self) -> bool

Returns true if the connection can continue after this error.

Recoverable errors (where a response can still be sent) return true:

  • Status — user-defined status response
  • NoRoute — 404, can send response and continue
  • PayloadTooLarge, MethodNotAllowed, UnsupportedMediaType — security checks
  • HeaderTooLarge, TooManyHeaders, HeaderLineTooLong — malformed request
  • ParseError, InvalidHeader, InvalidUri, ChunkError — parsing failures
  • VersionNotSupported, ProtocolViolation — protocol issues
  • Timeout — timeout
  • Other — catch-all

Non-recoverable errors return false:

  • Io — I/O errors usually mean the connection is broken
  • Connection — connection-level failures

Implementors§

Source§

impl<T> ProtocolError for T
where T: Error + Send + Sync + 'static + DefaultProtocolError,