aboutsummaryrefslogtreecommitdiff
path: root/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/errors.rs')
-rw-r--r--src/errors.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/errors.rs b/src/errors.rs
index e0a6df9..cbec046 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -20,7 +20,16 @@ pub enum ServiceError {
Reqwest(#[from] reqwest::Error),
#[error("Command error: {0}")]
- Command(#[from] std::io::Error)
+ Command(#[from] std::io::Error),
+
+ #[error("Not authorized")]
+ NotAuthorized,
+
+ #[error("Generic: {0}")]
+ Generic(String),
+
+ #[error("Paseto: {0}")]
+ Paseto(#[from] pasetors::errors::Error),
}
pub type StringResult<T = &'static str> = std::result::Result<T, ServiceError>;
@@ -35,6 +44,7 @@ impl IntoResponse for ServiceError {
let status = match self {
ServiceError::NotFound => StatusCode::NOT_FOUND,
+ ServiceError::NotAuthorized => StatusCode::UNAUTHORIZED,
_ => StatusCode::INTERNAL_SERVER_ERROR,
};
Response::builder()