add log to error functors for Result::map_or_else

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-04 23:53:30 +00:00
parent 2bc53139fa
commit 04e3de08eb

View file

@ -19,7 +19,8 @@ use ruma::{
OwnedServerName,
};
use thiserror::Error;
use tracing::error;
use crate::{debug_error, error};
#[derive(Error)]
pub enum Error {
@ -126,6 +127,18 @@ impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{self}") }
}
#[inline]
pub fn log(e: Error) {
error!("{e}");
drop(e);
}
#[inline]
pub fn debug_log(e: Error) {
debug_error!("{e}");
drop(e);
}
#[derive(Clone)]
pub struct RumaResponse<T>(pub T);