diff options
author | Cara Salter <cara@devcara.com> | 2022-06-28 07:07:34 -0400 |
---|---|---|
committer | Cara Salter <cara@devcara.com> | 2022-06-28 07:07:34 -0400 |
commit | 8de1eae2b49d763dcac55b8a2a84673475a35e63 (patch) | |
tree | 3b2d385b590c4211cf311042122563b89dcc6e51 /src/errors.rs | |
parent | f516a9616b7160be149ef4ba8726557e019bf621 (diff) | |
download | solard-8de1eae2b49d763dcac55b8a2a84673475a35e63.tar.gz solard-8de1eae2b49d763dcac55b8a2a84673475a35e63.zip |
auth: Scaffold auth/begin [WIP]
Diffstat (limited to 'src/errors.rs')
-rw-r--r-- | src/errors.rs | 12 |
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() |