diff --git a/actix/Cargo.toml b/actix/Cargo.toml index 1fe9194..0392c99 100644 --- a/actix/Cargo.toml +++ b/actix/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "http-signature-normalization-actix" description = "An HTTP Signatures library that leaves the signing to you" -version = "0.7.0" +version = "0.7.1" authors = ["asonix "] license = "AGPL-3.0" readme = "README.md" diff --git a/actix/src/middleware.rs b/actix/src/middleware.rs index b2d18f0..4bf6ee6 100644 --- a/actix/src/middleware.rs +++ b/actix/src/middleware.rs @@ -72,14 +72,32 @@ impl std::fmt::Display for HeaderKind { } } -#[derive(Clone, Debug, thiserror::Error)] -#[error("Failed to verify http signature, {kind}")] +#[derive(Clone)] #[doc(hidden)] pub struct VerifyError { context: SpanTrace, kind: VerifyErrorKind, } +impl std::fmt::Debug for VerifyError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + writeln!(f, "{:?}", self.kind) + } +} + +impl std::fmt::Display for VerifyError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + writeln!(f, "{}", self.kind)?; + std::fmt::Display::fmt(&self.context, f) + } +} + +impl std::error::Error for VerifyError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + self.kind.source() + } +} + #[derive(Clone, Debug, thiserror::Error)] enum VerifyErrorKind { #[error("Signature or Authorization header is missing")]