Skip to main content

AlienErrorData

Trait AlienErrorData 

Source
pub trait AlienErrorData {
    // Required methods
    fn code(&self) -> &'static str;
    fn retryable(&self) -> bool;
    fn internal(&self) -> bool;
    fn message(&self) -> String;

    // Provided methods
    fn http_status_code(&self) -> u16 { ... }
    fn context(&self) -> Option<Value> { ... }
    fn retryable_inherit(&self) -> Option<bool> { ... }
    fn internal_inherit(&self) -> Option<bool> { ... }
    fn http_status_code_inherit(&self) -> Option<u16> { ... }
}
Expand description

Data every public-facing error variant must expose.

Required Methods§

Source

fn code(&self) -> &'static str

Short machine-readable identifier (“NOT_FOUND”, “TIMEOUT”, …).

Source

fn retryable(&self) -> bool

Whether the failing operation can be retried.

Source

fn internal(&self) -> bool

Whether the error is internal (should not be shown to end users).

Source

fn message(&self) -> String

Human-readable message (defaults to Display).

Provided Methods§

Source

fn http_status_code(&self) -> u16

HTTP status code for this error (defaults to 500).

Source

fn context(&self) -> Option<Value>

Optional diagnostic payload built from struct/enum fields.

Source

fn retryable_inherit(&self) -> Option<bool>

Whether to inherit the retryable flag from the source error. Returns None if this error should inherit from source, Some(value) for explicit value.

Source

fn internal_inherit(&self) -> Option<bool>

Whether to inherit the internal flag from the source error. Returns None if this error should inherit from source, Some(value) for explicit value.

Source

fn http_status_code_inherit(&self) -> Option<u16>

Whether to inherit the HTTP status code from the source error. Returns None if this error should inherit from source, Some(value) for explicit value.

Implementors§