pub struct Error {
pub category: ErrorCategory,
pub code: ErrorCode,
pub message: String,
pub cause: Option<Box<Error>>,
pub location: Option<ErrorLocation>,
}Expand description
Primary error type for the entire Rill ecosystem.
Fields§
§category: ErrorCategoryHigh-level error category for grouping.
code: ErrorCodeMachine-processable error code.
message: StringHuman-readable error description.
cause: Option<Box<Error>>Optional chained cause (builder-style via Error::with_cause).
location: Option<ErrorLocation>Optional source location (attached via Error::at).
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(code: ErrorCode, message: impl Into<String>) -> Self
pub fn new(code: ErrorCode, message: impl Into<String>) -> Self
Create a new error with the given code and message.
Sourcepub fn with_cause(self, cause: Error) -> Self
pub fn with_cause(self, cause: Error) -> Self
Add a cause to this error (builder-style).
Sourcepub fn at(self, file: &'static str, line: u32, column: u32) -> Self
pub fn at(self, file: &'static str, line: u32, column: u32) -> Self
Attach source location info (builder-style).
Sourcepub fn root_cause(&self) -> &Error
pub fn root_cause(&self) -> &Error
Walk the cause chain to find the root cause.
Sourcepub fn is_realtime_critical(&self) -> bool
pub fn is_realtime_critical(&self) -> bool
Whether this error is critical for a real-time thread.
Sourcepub fn is_recoverable(&self) -> bool
pub fn is_recoverable(&self) -> bool
Whether this error is recoverable (non-critical).
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn StdError + 'static)>
fn source(&self) -> Option<&(dyn StdError + '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 From<Error> for ProcessError
impl From<Error> for ProcessError
Source§impl From<ParseFloatError> for Error
impl From<ParseFloatError> for Error
Source§fn from(err: ParseFloatError) -> Self
fn from(err: ParseFloatError) -> Self
Converts to this type from the input type.
Source§impl From<ParseIntError> for Error
impl From<ParseIntError> for Error
Source§fn from(err: ParseIntError) -> Self
fn from(err: ParseIntError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
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