From c2bf620b445f1cf7800adaab19571ef7150767f2 Mon Sep 17 00:00:00 2001 From: Alexander 'z33ky' Hirsch <1zeeky@gmail.com> Date: Sat, 4 Mar 2023 16:04:20 +0100 Subject: [PATCH] argon2: provide std::error::Error::source() for Error The Error type sometimes wraps other errors, which are now returned by the source() method. --- argon2/src/error.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/argon2/src/error.rs b/argon2/src/error.rs index f6f10e70..3a6b9646 100644 --- a/argon2/src/error.rs +++ b/argon2/src/error.rs @@ -121,4 +121,11 @@ impl From for password_hash::Error { } #[cfg(feature = "std")] -impl std::error::Error for Error {} +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Self::B64Encoding(err) => Some(err), + _ => None, + } + } +}