pub enum Error {
DatabaseError(MessageResource, String),
ClientError(MessageResource),
UnexpectedStatusCode(u16, u16, Vec<MessageResource>),
Unspecified,
SerdeError(MessageResource, String),
ComputeError(MessageResource),
NetworkError(MessageResource),
}
Expand description
This is supposed to be used whenever you have an error in your code and want to be more specific about it. Fits in with most CRUD web apps. What you send back to the client is a MessageResource, not the error itself!
Variants
DatabaseError(MessageResource, String)
Takes a Message and the query
ClientError(MessageResource)
Same as UnexpectedStatusCode but without the extra details.
UnexpectedStatusCode(u16, u16, Vec<MessageResource>)
Takes the status code you expected, the actual status code, and the ErrorMessage. This is meant to be used when your app tries to use an API, be it internal or external.
Unspecified
Try and never use this error, unless you really need to.
SerdeError(MessageResource, String)
If you had an error serializing/deserializing and wish to display more details. Such as the entire Json as a string, this is how.
ComputeError(MessageResource)
Normally used in compute heavy operations, such as Hashing.
NetworkError(MessageResource)
Self explanatory, Network related error.
Trait Implementations
sourceimpl ReturnableErrorShape for Error
impl ReturnableErrorShape for Error
fn convert_to_returnable<T: Serialize>(
&self,
status_code: u16
) -> TypedHttpResponse<T>
Auto Trait Implementations
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more