add log to error functors for Result::map_or_else
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
2bc53139fa
commit
04e3de08eb
1 changed files with 14 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue