Made error implement std::error::Error
This commit is contained in:
parent
3d35d493b5
commit
ebcdd5b4f5
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -183,7 +183,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "actix-web-utils"
|
name = "actix-web-utils"
|
||||||
version = "0.2.14"
|
version = "0.2.15"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"log",
|
"log",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-web-utils"
|
name = "actix-web-utils"
|
||||||
version = "0.2.14"
|
version = "0.2.15"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Franklin E. Blanco"]
|
authors = ["Franklin E. Blanco"]
|
||||||
description = "Just some useful addons for actix web."
|
description = "Just some useful addons for actix web."
|
||||||
|
@ -5,6 +5,7 @@ use crate::dtos::message::MessageResource;
|
|||||||
|
|
||||||
/// This is supposed to be used whenever you have an error in your code and want to be more specific about it.
|
/// 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!
|
/// Fits in with most CRUD web apps. What you send back to the client is a MessageResource, not the error itself!
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum Error{
|
pub enum Error{
|
||||||
/// Takes a Message and the query
|
/// Takes a Message and the query
|
||||||
DatabaseError(MessageResource, String),
|
DatabaseError(MessageResource, String),
|
||||||
@ -34,4 +35,5 @@ impl fmt::Display for Error{
|
|||||||
Error::ComputeError(message) => write!(f, "Error of type Compute.\nMessageResource: {}", message),
|
Error::ComputeError(message) => write!(f, "Error of type Compute.\nMessageResource: {}", message),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl std::error::Error for Error {}
|
Loading…
Reference in New Issue
Block a user