mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-24 12:35:31 +00:00
feat: errors
This commit is contained in:
parent
129b0f198f
commit
4ab6f16774
2 changed files with 10 additions and 0 deletions
9
core/src/error.rs
Normal file
9
core/src/error.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
pub struct Status {
|
||||
pub code: u16,
|
||||
}
|
||||
|
||||
pub const InvalidCredentialsError: ServiceError<String> = ServiceError(Status { code: 401 },
|
||||
"Invalid credentials".to_string());
|
||||
pub const JwtError: ServiceError<String> = ServiceError(Status { code: 500 },
|
||||
"Error while encoding JWT".to_string());
|
||||
pub struct ServiceError<R>(pub Status, pub R);
|
||||
|
|
@ -3,6 +3,7 @@ mod query;
|
|||
pub mod crypto;
|
||||
pub mod token;
|
||||
pub mod services;
|
||||
pub mod error;
|
||||
|
||||
pub use mutation::*;
|
||||
pub use query::*;
|
||||
|
|
|
|||
Loading…
Reference in a new issue