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.