pub trait RokException:
Error
+ Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn status_code(&self) -> u16;
// Provided methods
fn self_handled(&self) -> bool { ... }
fn translation_id(&self) -> Option<&'static str> { ... }
fn help(&self) -> Option<&'static str> { ... }
}Expand description
Base trait for all typed exceptions in the rok ecosystem.
Analogous to AdonisJS Exception — every crate exposes E_* structs
implementing this trait. Self-handled exceptions can convert themselves
to an HTTP response; non-self-handled ones must be caught by a global
error handler.
Required Methods§
Sourcefn status_code(&self) -> u16
fn status_code(&self) -> u16
HTTP status code.
Provided Methods§
Sourcefn self_handled(&self) -> bool
fn self_handled(&self) -> bool
Whether this exception can produce its own HTTP response.
Sourcefn translation_id(&self) -> Option<&'static str>
fn translation_id(&self) -> Option<&'static str>
Optional i18n translation key.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".