Trait ForgeError

Source
pub trait ForgeError:
    Error
    + Send
    + Sync
    + 'static {
    // Required methods
    fn kind(&self) -> &'static str;
    fn caption(&self) -> &'static str;

    // Provided methods
    fn is_retryable(&self) -> bool { ... }
    fn is_fatal(&self) -> bool { ... }
    fn status_code(&self) -> u16 { ... }
    fn exit_code(&self) -> i32 { ... }
    fn user_message(&self) -> String { ... }
    fn dev_message(&self) -> String { ... }
    fn backtrace(&self) -> Option<&Backtrace> { ... }
    fn register(&self) { ... }
}
Expand description

Base trait for all custom error variants.

Required Methods§

Source

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

Returns the kind of error, typically matching the enum variant

Source

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

Returns a human-readable caption for the error

Provided Methods§

Source

fn is_retryable(&self) -> bool

Returns true if the operation can be retried

Source

fn is_fatal(&self) -> bool

Returns true if the error is fatal and should terminate the program

Source

fn status_code(&self) -> u16

Returns an appropriate HTTP status code for the error

Source

fn exit_code(&self) -> i32

Returns an appropriate process exit code for the error

Source

fn user_message(&self) -> String

Returns a user-facing message that can be shown to end users

Source

fn dev_message(&self) -> String

Returns a detailed technical message for developers/logs

Source

fn backtrace(&self) -> Option<&Backtrace>

Returns a backtrace if available

Source

fn register(&self)

Registers the error with the central error registry

Implementors§