From 4ab6f16774352af1130e7480dfbc41dd51050e4d Mon Sep 17 00:00:00 2001 From: Sebastian Pravda Date: Tue, 25 Oct 2022 19:07:55 +0200 Subject: [PATCH] feat: errors --- core/src/error.rs | 9 +++++++++ core/src/lib.rs | 1 + 2 files changed, 10 insertions(+) create mode 100644 core/src/error.rs diff --git a/core/src/error.rs b/core/src/error.rs new file mode 100644 index 0000000..a76d2ec --- /dev/null +++ b/core/src/error.rs @@ -0,0 +1,9 @@ +pub struct Status { + pub code: u16, +} + +pub const InvalidCredentialsError: ServiceError = ServiceError(Status { code: 401 }, + "Invalid credentials".to_string()); +pub const JwtError: ServiceError = ServiceError(Status { code: 500 }, + "Error while encoding JWT".to_string()); +pub struct ServiceError(pub Status, pub R); \ No newline at end of file diff --git a/core/src/lib.rs b/core/src/lib.rs index 942af37..71b5ace 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -3,6 +3,7 @@ mod query; pub mod crypto; pub mod token; pub mod services; +pub mod error; pub use mutation::*; pub use query::*;