From d241e00fcfba0731118f5e6f6a0094c15d5ecd26 Mon Sep 17 00:00:00 2001 From: constantoine Date: Wed, 2 Nov 2022 11:29:04 +0100 Subject: [PATCH] Implement std::error::Error for totp-rs error types Signed-off-by: constantoine --- src/rfc.rs | 2 ++ src/url_error.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/rfc.rs b/src/rfc.rs index 34204a7..5863bb6 100644 --- a/src/rfc.rs +++ b/src/rfc.rs @@ -14,6 +14,8 @@ pub enum Rfc6238Error { SecretTooSmall(usize), } +impl std::error::Error for Rfc6238Error {} + impl std::fmt::Display for Rfc6238Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { diff --git a/src/url_error.rs b/src/url_error.rs index 76ef73f..3d63de2 100644 --- a/src/url_error.rs +++ b/src/url_error.rs @@ -22,6 +22,8 @@ pub enum TotpUrlError { AccountNameDecoding(String), } +impl std::error::Error for TotpUrlError {} + impl std::fmt::Display for TotpUrlError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self {