Struct fisher_common::errors::Error
[−]
[src]
pub struct Error { /* fields omitted */ }
This class represents an error that occured in Fisher.
It contains all the details known about it, and you can either access it programmatically or display the error message to the user, already formatted. It also support automatic conversion from the error types of the libraries Fisher depends on.
Methods
impl Error
[src]
fn new(kind: ErrorKind) -> Self
Create a new error. You need to provide the kind of error that occured.
Example
fn my_function() -> Result<()> { let error = Error::new(ErrorKind::Dummy); Err(error) }
fn set_location(&mut self, location: ErrorLocation)
Set the location where the error occured.
fn location(&self) -> &ErrorLocation
Get the location where the error occured. You can either access it programmatically or print a pretty version of it to the user.
fn kind(&self) -> &ErrorKind
Get the kind of error occured. You can either access it programmatically or print a pretty version of it to the user.
fn pretty_print(&self)
Show a nicely-formatted version of the error, usually for printing it to the user. The function uses ANSI formatting codes.
if let Err(error) = do_work() { error.pretty_print(); }
Trait Implementations
impl Debug for Error
[src]
impl Display for Error
[src]
impl StdError for Error
[src]
fn description(&self) -> &str
A short description of the error. Read more
fn cause(&self) -> Option<&StdError>
The lower-level cause of this error, if any. Read more
impl From<ErrorKind> for Error
[src]
impl From<RecvError> for Error
[src]
impl<T> From<SendError<T>> for Error
[src]
impl<T> From<PoisonError<T>> for Error
[src]
fn from(_: PoisonError<T>) -> Self
Performs the conversion.
impl From<Error> for Error
[src]
impl From<Error> for Error
[src]
impl From<AddrParseError> for Error
[src]
fn from(error: AddrParseError) -> Self
Performs the conversion.
impl From<ParseIntError> for Error
[src]
fn from(error: ParseIntError) -> Self
Performs the conversion.