Skip to main content

ToHttpStatus

Trait ToHttpStatus 

Source
pub trait ToHttpStatus {
    // Required methods
    fn status_code(&self) -> u16;
    fn error_code(&self) -> &str;
}
Expand description

Convert errors to HTTP status codes for API responses

This trait maps domain errors to appropriate HTTP status codes.

Required Methods§

Source

fn status_code(&self) -> u16

Get the HTTP status code for this error

Source

fn error_code(&self) -> &str

Get the machine-readable error code

Implementors§