From f3f2be99f35d6289e2d9b361e16daf38d2373f06 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sun, 14 Jul 2024 20:21:52 -0500 Subject: [PATCH] WIP --- src/state.rs | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/state.rs b/src/state.rs index 6032642..994ecbf 100644 --- a/src/state.rs +++ b/src/state.rs @@ -23,10 +23,36 @@ pub struct Creds { pub password: Secret, } -#[derive(thiserror::Error, Debug)] -pub enum AuthnError { - #[error("{0}")] - Eyre(#[from] Error), +#[derive(Debug)] +pub struct AuthnError {} + +impl std::fmt::Display for AuthnError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("authentication error"); + Ok(()) + } +} + +impl From for AuthnError { + fn from(_value: Error) -> Self { + Self {} + } +} + +impl std::error::Error for AuthnError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + None + } + + fn description(&self) -> &str { + "description() is deprecated; use Display" + } + + fn cause(&self) -> Option<&dyn std::error::Error> { + self.source() + } + + fn provide<'a>(&'a self, request: &mut std::error::Request<'a>) {} } #[async_trait]