From fd7dccddeaaf7c9a2be84cc8065223a5f2daa83f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sun, 7 Apr 2024 12:21:23 +0200 Subject: [PATCH] Allow to compare errors --- src/error.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/error.rs b/src/error.rs index c96cd77..1f059a4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,6 @@ pub(crate) type Result = core::result::Result; -#[derive(thiserror::Error, Debug)] +#[derive(thiserror::Error, Debug, PartialEq)] pub enum Error { #[error("cipher error: {0}")] ChaCha20Poly1305Error(chacha20poly1305::Error), @@ -33,7 +33,7 @@ pub enum Error { #[error("unable to generate random values: {0}")] RandomSourceError(getrandom::Error), #[error("system time error: {0}")] - SystemTimeError(std::time::SystemTimeError), + SystemTimeError(String), #[error("system time error: {0}: unable to represent this timestamp as a system time")] SystemTimeReprError(u64), } @@ -58,6 +58,6 @@ impl From for Error { impl From for Error { fn from(error: std::time::SystemTimeError) -> Self { - Error::SystemTimeError(error) + Error::SystemTimeError(error.to_string()) } }