feat: errors

This commit is contained in:
Sebastian Pravda 2022-10-25 19:07:55 +02:00
parent 129b0f198f
commit 4ab6f16774
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57
2 changed files with 10 additions and 0 deletions

9
core/src/error.rs Normal file
View 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);

View file

@ -3,6 +3,7 @@ mod query;
pub mod crypto;
pub mod token;
pub mod services;
pub mod error;
pub use mutation::*;
pub use query::*;