From 7d9a11dcda864a314c741c57df05635014f7f593 Mon Sep 17 00:00:00 2001 From: cyqsimon <28627918+cyqsimon@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:11:23 +0800 Subject: Refactor errors - Split `ContexualError` into `StartError` & `RuntimeError` - Made sure every `RuntimeError` variant has an accurate status code --- src/auth.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/auth.rs') diff --git a/src/auth.rs b/src/auth.rs index 92157c9..ef16b0c 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -2,7 +2,7 @@ use actix_web::{dev::ServiceRequest, HttpMessage}; use actix_web_httpauth::extractors::basic::BasicAuth; use sha2::{Digest, Sha256, Sha512}; -use crate::errors::ContextualError; +use crate::errors::RuntimeError; #[derive(Clone, Debug)] /// HTTP Basic authentication parameters @@ -86,7 +86,7 @@ pub async fn handle_auth( if match_auth(&cred.into(), required_auth) { Ok(req) } else { - Err((ContextualError::InvalidHttpCredentials.into(), req)) + Err((RuntimeError::InvalidHttpCredentials.into(), req)) } } -- cgit v1.2.3