From 5c085b2ec76381cd4b54c097c79689f6a77b7431 Mon Sep 17 00:00:00 2001 From: Niko PLP Date: Wed, 2 Aug 2023 21:06:57 +0300 Subject: [PATCH] logging in get_or_create_single_key --- p2p-broker/src/broker_store/wallet.rs | 2 ++ p2p-repo/src/store.rs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/p2p-broker/src/broker_store/wallet.rs b/p2p-broker/src/broker_store/wallet.rs index a7b6e2b..8b0fc34 100644 --- a/p2p-broker/src/broker_store/wallet.rs +++ b/p2p-broker/src/broker_store/wallet.rs @@ -11,6 +11,7 @@ use p2p_net::types::*; use p2p_repo::kcv_store::KCVStore; +use p2p_repo::log::*; use p2p_repo::store::*; use p2p_repo::types::*; use serde::{Deserialize, Serialize}; @@ -53,6 +54,7 @@ impl<'a> Wallet<'a> { if e == StorageError::NotFound { self.create_single_key(prefix, key) } else { + log_debug!("Error while creating single key {}", e); Err(StorageError::BackendError) } } diff --git a/p2p-repo/src/store.rs b/p2p-repo/src/store.rs index 5ed81fe..0ee6c2c 100644 --- a/p2p-repo/src/store.rs +++ b/p2p-repo/src/store.rs @@ -43,6 +43,12 @@ pub enum StorageError { AlreadyExists, } +impl core::fmt::Display for StorageError { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{:?}", self) + } +} + impl From for StorageError { fn from(e: serde_bare::error::Error) -> Self { StorageError::SerializationError