feat: Integration with persy using background ops
This commit is contained in:
15
src/error.rs
15
src/error.rs
@@ -8,6 +8,9 @@ use ruma::{
|
||||
use thiserror::Error;
|
||||
use tracing::warn;
|
||||
|
||||
#[cfg(feature = "persy")]
|
||||
use persy::PersyError;
|
||||
|
||||
#[cfg(feature = "conduit_bin")]
|
||||
use {
|
||||
crate::RumaResponse,
|
||||
@@ -36,6 +39,9 @@ pub enum Error {
|
||||
#[from]
|
||||
source: rusqlite::Error,
|
||||
},
|
||||
#[cfg(feature = "persy")]
|
||||
#[error("There was a problem with the connection to the persy database.")]
|
||||
PersyError { source: PersyError },
|
||||
#[cfg(feature = "heed")]
|
||||
#[error("There was a problem with the connection to the heed database: {error}")]
|
||||
HeedError { error: String },
|
||||
@@ -142,3 +148,12 @@ where
|
||||
self.to_response().respond_to(r)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "persy")]
|
||||
impl<T: Into<PersyError>> From<persy::PE<T>> for Error {
|
||||
fn from(err: persy::PE<T>) -> Self {
|
||||
Error::PersyError {
|
||||
source: err.error().into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user