convert rocksdb errors locally; remove from Error.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-12 01:08:07 +00:00
parent c1712d4d8b
commit 01f4455ceb
6 changed files with 65 additions and 58 deletions

View file

@ -24,14 +24,10 @@ release_max_log_level = [
"log/max_level_trace",
"log/release_max_level_info",
]
rocksdb = [
"dep:rust-rocksdb",
]
jemalloc = [
"dep:tikv-jemalloc-sys",
"dep:tikv-jemalloc-ctl",
"dep:tikv-jemallocator",
"rust-rocksdb/jemalloc",
]
jemalloc_prof = [
"tikv-jemalloc-sys/profiling",
@ -39,18 +35,13 @@ jemalloc_prof = [
hardened_malloc = [
"dep:hardened_malloc-rs"
]
io_uring = [
"rust-rocksdb/io-uring",
]
zstd_compression = [
"rust-rocksdb/zstd",
]
gzip_compression = [
"reqwest/gzip",
]
brotli_compression = [
"reqwest/brotli",
]
zstd_compression =[]
perf_measurements = []
sentry_telemetry = []
@ -72,8 +63,13 @@ regex.workspace = true
reqwest.workspace = true
ring.workspace = true
ruma.workspace = true
<<<<<<< HEAD
rust-rocksdb.optional = true
rust-rocksdb.workspace = true
=======
rusqlite.optional = true
rusqlite.workspace = true
>>>>>>> 6963b38f (convert rocksdb errors locally; remove from Error.)
sanitize-filename.workspace = true
serde_json.workspace = true
serde_regex.workspace = true

View file

@ -25,12 +25,8 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Error)]
pub enum Error {
#[cfg(feature = "rocksdb")]
#[error("There was a problem with the connection to the rocksdb database: {source}")]
RocksDb {
#[from]
source: rust_rocksdb::Error,
},
#[error("{0}")]
Database(String),
#[error("Could not generate an image: {source}")]
Image {
#[from]
@ -114,8 +110,7 @@ impl Error {
let db_error = String::from("Database or I/O error occurred.");
match self {
#[cfg(feature = "rocksdb")]
Self::RocksDb {
Self::Database {
..
} => db_error,
Self::Io {