mirror of
https://git.asonix.dog/asonix/http-signature-normalization.git
synced 2024-11-21 08:51:00 +00:00
Improve error message
This commit is contained in:
parent
1224b3201c
commit
3e2639670e
2 changed files with 21 additions and 3 deletions
|
@ -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 <asonix@asonix.dog>"]
|
||||
license = "AGPL-3.0"
|
||||
readme = "README.md"
|
||||
|
|
|
@ -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")]
|
||||
|
|
Loading…
Reference in a new issue