pub enum CommonError {
InvalidInput(String),
Config(String),
Io(Error),
Parse(String),
NotFound(String),
PermissionDenied(String),
Timeout(String),
External(String),
Custom(String),
}Available on crate feature
error only.Expand description
Common error type for ecosystem projects.
This enum covers the most common error cases encountered across projects. For project-specific errors, consider wrapping this or creating derived types.
Variants§
InvalidInput(String)
Invalid input provided to a function.
Config(String)
Configuration error.
Io(Error)
IO operation failed.
Parse(String)
Parse error for various formats.
NotFound(String)
Resource not found.
PermissionDenied(String)
Operation not permitted.
Timeout(String)
Operation timed out.
External(String)
External service error.
Custom(String)
Generic error with custom message.
Implementations§
Source§impl CommonError
impl CommonError
Sourcepub fn invalid_input(msg: impl Into<String>) -> Self
pub fn invalid_input(msg: impl Into<String>) -> Self
Create a new invalid input error.
Sourcepub const fn is_input_error(&self) -> bool
pub const fn is_input_error(&self) -> bool
Check if this is an input validation error.
Sourcepub const fn is_recoverable(&self) -> bool
pub const fn is_recoverable(&self) -> bool
Check if this is a recoverable error.
Trait Implementations§
Source§impl Debug for CommonError
impl Debug for CommonError
Source§impl Display for CommonError
impl Display for CommonError
Source§impl Error for CommonError
impl Error for CommonError
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()
Auto Trait Implementations§
impl Freeze for CommonError
impl !RefUnwindSafe for CommonError
impl Send for CommonError
impl Sync for CommonError
impl Unpin for CommonError
impl UnsafeUnpin for CommonError
impl !UnwindSafe for CommonError
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