pub enum AppError {
Config {
message: String,
},
Filesystem {
path: Option<PathBuf>,
source: Error,
},
Network {
endpoint: String,
source: Option<Box<dyn StdError + Send + Sync>>,
},
Other {
message: String,
},
}
Expand description
Example error enum that can be replaced by the define_errors! macro.
Variants§
Config
Configuration-related errors
Filesystem
Filesystem-related errors with optional path and source error
Network
Network-related errors
Other
Generic errors for anything not covered by specific variants
Implementations§
Trait Implementations§
Source§impl Error for AppError
impl Error for AppError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl ForgeError for AppError
impl ForgeError for AppError
Source§fn is_retryable(&self) -> bool
fn is_retryable(&self) -> bool
Returns true if the operation can be retried
Source§fn status_code(&self) -> u16
fn status_code(&self) -> u16
Returns an appropriate HTTP status code for the error
Source§fn is_fatal(&self) -> bool
fn is_fatal(&self) -> bool
Returns true if the error is fatal and should terminate the program
Source§fn user_message(&self) -> String
fn user_message(&self) -> String
Returns a user-facing message that can be shown to end users
Source§fn dev_message(&self) -> String
fn dev_message(&self) -> String
Returns a detailed technical message for developers/logs
Auto Trait Implementations§
impl Freeze for AppError
impl !RefUnwindSafe for AppError
impl Send for AppError
impl Sync for AppError
impl Unpin for AppError
impl !UnwindSafe for AppError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more