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::*;