Skip to main content

HttpModeledError

Trait HttpModeledError 

Source
pub trait HttpModeledError:
    SerializableStruct
    + Error
    + Send
    + Sync
    + 'static {
    // Required method
    fn status_code(&self) -> u16;

    // Provided method
    fn operation_schema(&self) -> Option<&OperationSchema<'_>> { ... }
}
Expand description

A modeled error that a ServerProtocol can turn into an HTTP response.

Required Methods§

Source

fn status_code(&self) -> u16

The HTTP status code for this error: @httpError when present, otherwise 400 for @error("client") shapes and 500 for @error("server") shapes.

Provided Methods§

Source

fn operation_schema(&self) -> Option<&OperationSchema<'_>>

The operation that returned this error, when known.

Generated operation error enums expose their operation’s input, output, and error schemas. Shared error structures and errors created outside an operation have no operation context. Each protocol decides whether to use this context.

Implementations on Foreign Types§

Source§

impl HttpModeledError for Infallible

Implementors§