From 8de1eae2b49d763dcac55b8a2a84673475a35e63 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Tue, 28 Jun 2022 07:07:34 -0400 Subject: auth: Scaffold auth/begin [WIP] --- src/errors.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/errors.rs') 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 = std::result::Result; @@ -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() -- cgit v1.2.3