pub struct Error { /* private fields */ }
Expand description
A universal error type which contains a source and a kind.
An error is either associated with the client or the server.
Implementations§
source§impl Error
impl Error
sourcepub fn new<K, E>(kind: K, error: E) -> Selfwhere
K: Into<ErrorKind>,
E: Into<Box<dyn ErrorTrait + Send + Sync>>,
pub fn new<K, E>(kind: K, error: E) -> Selfwhere K: Into<ErrorKind>, E: Into<Box<dyn ErrorTrait + Send + Sync>>,
Creates a new error.
sourcepub fn empty<K>(kind: K) -> Selfwhere
K: Into<ErrorKind>,
pub fn empty<K>(kind: K) -> Selfwhere K: Into<ErrorKind>,
Creates a new error without a source.
sourcepub fn status_code(&self) -> StatusCode
pub fn status_code(&self) -> StatusCode
Returns the StatusCode
corresponding to the ErrorKind
.
sourcepub fn from_client_io(error: Error) -> Self
pub fn from_client_io(error: Error) -> Self
Returns a new error from an io::Error originating from the client.
sourcepub fn from_server_error<E>(error: E) -> Selfwhere
E: Into<Box<dyn ErrorTrait + Send + Sync>>,
pub fn from_server_error<E>(error: E) -> Selfwhere E: Into<Box<dyn ErrorTrait + Send + Sync>>,
Returns a new error originating from the server.
Trait Implementations§
source§impl Error for Error
impl Error for Error
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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<DeserializeError> for Error
impl From<DeserializeError> for Error
source§fn from(e: DeserializeError) -> Self
fn from(e: DeserializeError) -> Self
Converts to this type from the input type.