#[non_exhaustive]pub struct RusticError { /* private fields */ }Expand description
Errors that can result from rustic.
Implementations§
Source§impl RusticError
impl RusticError
Sourcepub fn new(kind: ErrorKind, guidance: impl Into<EcoString>) -> Box<RusticError>
pub fn new(kind: ErrorKind, guidance: impl Into<EcoString>) -> Box<RusticError>
Creates a new error with the given kind and guidance.
Sourcepub fn with_source(
kind: ErrorKind,
guidance: impl Into<EcoString>,
source: impl Into<Box<dyn Error + Sync + Send>>,
) -> Box<RusticError>
pub fn with_source( kind: ErrorKind, guidance: impl Into<EcoString>, source: impl Into<Box<dyn Error + Sync + Send>>, ) -> Box<RusticError>
Creates a new error with the given kind and guidance.
Sourcepub fn is_incorrect_password(&self) -> bool
pub fn is_incorrect_password(&self) -> bool
Checks if the error is due to an incorrect password
Sourcepub fn from<T>(kind: ErrorKind, error: T) -> Box<RusticError>
pub fn from<T>(kind: ErrorKind, error: T) -> Box<RusticError>
Creates a new error from a given error.
Sourcepub fn display_log(&self) -> String
pub fn display_log(&self) -> String
Returns a String representation for logging purposes.
This is a more concise version of the error message.
Source§impl RusticError
impl RusticError
Sourcepub fn overwrite_kind(self, value: impl Into<ErrorKind>) -> Box<RusticError>
pub fn overwrite_kind(self, value: impl Into<ErrorKind>) -> Box<RusticError>
Attach what kind the error is.
Sourcepub fn ask_report(self) -> Box<RusticError>
pub fn ask_report(self) -> Box<RusticError>
Ask the user to report the error.
Sourcepub fn attach_source(
self,
value: impl Into<Box<dyn Error + Sync + Send>>,
) -> Box<RusticError>
pub fn attach_source( self, value: impl Into<Box<dyn Error + Sync + Send>>, ) -> Box<RusticError>
Attach a chain to the cause of the error.
Sourcepub fn overwrite_guidance(self, value: impl Into<EcoString>) -> Box<RusticError>
pub fn overwrite_guidance(self, value: impl Into<EcoString>) -> Box<RusticError>
Attach the error message with guidance.
Sourcepub fn append_guidance_line(
self,
value: impl Into<EcoString>,
) -> Box<RusticError>
pub fn append_guidance_line( self, value: impl Into<EcoString>, ) -> Box<RusticError>
Append a newline to the guidance message. This is useful for adding additional information to the guidance.
Sourcepub fn prepend_guidance_line(
self,
value: impl Into<EcoString>,
) -> Box<RusticError>
pub fn prepend_guidance_line( self, value: impl Into<EcoString>, ) -> Box<RusticError>
Prepend a newline to the guidance message. This is useful for adding additional information to the guidance.
Sourcepub fn attach_context(
self,
key: impl Into<EcoString>,
value: impl Into<EcoString>,
) -> Box<RusticError>
pub fn attach_context( self, key: impl Into<EcoString>, value: impl Into<EcoString>, ) -> Box<RusticError>
Attach context to the error.
Sourcepub fn overwrite_context(
self,
value: impl Into<EcoVec<(EcoString, EcoString)>>,
) -> Box<RusticError>
pub fn overwrite_context( self, value: impl Into<EcoVec<(EcoString, EcoString)>>, ) -> Box<RusticError>
Overwrite context of the error.
§Caution
This should not be used in most cases, as it will overwrite any existing contexts.
Rather use attach_context for multiple contexts.
Sourcepub fn attach_docs_url(self, value: impl Into<EcoString>) -> Box<RusticError>
pub fn attach_docs_url(self, value: impl Into<EcoString>) -> Box<RusticError>
Attach the URL of the documentation for the error.
Sourcepub fn attach_error_code(self, value: impl Into<EcoString>) -> Box<RusticError>
pub fn attach_error_code(self, value: impl Into<EcoString>) -> Box<RusticError>
Attach an error code.
Sourcepub fn attach_new_issue_url(
self,
value: impl Into<EcoString>,
) -> Box<RusticError>
pub fn attach_new_issue_url( self, value: impl Into<EcoString>, ) -> Box<RusticError>
Attach the URL of the issue tracker for opening a new issue.
Sourcepub fn attach_existing_issue_url(
self,
value: impl Into<EcoString>,
) -> Box<RusticError>
pub fn attach_existing_issue_url( self, value: impl Into<EcoString>, ) -> Box<RusticError>
Attach the URL of an already existing issue that is related to this error.
Sourcepub fn attach_severity(self, value: impl Into<Severity>) -> Box<RusticError>
pub fn attach_severity(self, value: impl Into<Severity>) -> Box<RusticError>
Attach the severity of the error.
Sourcepub fn attach_status(self, value: impl Into<Status>) -> Box<RusticError>
pub fn attach_status(self, value: impl Into<Status>) -> Box<RusticError>
Attach the status of the error.
Sourcepub fn overwrite_backtrace(
self,
value: impl Into<Backtrace>,
) -> Box<RusticError>
pub fn overwrite_backtrace( self, value: impl Into<Backtrace>, ) -> Box<RusticError>
Overwrite the backtrace of the error.
This should not be used in most cases, as the backtrace is automatically captured.
Trait Implementations§
Source§impl Debug for RusticError
impl Debug for RusticError
Source§impl Display for RusticError
impl Display for RusticError
Source§impl Error for RusticError
impl Error for RusticError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl !Freeze for RusticError
impl !RefUnwindSafe for RusticError
impl Send for RusticError
impl Sync for RusticError
impl Unpin for RusticError
impl UnsafeUnpin for RusticError
impl !UnwindSafe for RusticError
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
Source§impl<T> CustomError for T
impl<T> CustomError for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.