From 417dd4dfeec1dbec748767d965b18651d55dedb7 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 14 Nov 2023 14:17:08 -0500 Subject: [PATCH 1/2] proj: add .idea to .gitignore This is helpful for Jetbrains IDE users (e.g. CLion). --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2eea0d3..20b656e 100755 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ evercrypt_provider/target rust_crypto_provider/target traits/target/ .DS_Store +/.idea From aa1cc82c2693a29faee12c12fc06bf4891038c02 Mon Sep 17 00:00:00 2001 From: Daniel McCarney Date: Tue, 14 Nov 2023 14:15:02 -0500 Subject: [PATCH 2/2] lib: implement std::error::Error for HpkeError This commit implements `std::error::Error`, and `std::fmt::Display` for `HpkeError`, matching the approach already used for `hpke_rs_crypto::Error`. This makes handling `HpkeError` as a generic `Error` easier in downstream crates. --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 23ad40a..2ecc24d 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -84,6 +84,14 @@ pub enum HpkeError { LockPoisoned, } +impl std::error::Error for HpkeError {} + +impl std::fmt::Display for HpkeError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "HPKE Error: {:?}", self) + } +} + #[deprecated( since = "0.0.7", note = "Please use HpkePublicKey instead. This alias will be removed with the first stable 0.1 release."