aboutsummaryrefslogtreecommitdiffstats
path: root/lib/shared-svc/src/lib.rs
blob: d4852a5a7c3d53197ca767af21ea11a6e2634337 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#[cfg(feature = "cache")]
pub mod cache;

#[cfg(feature = "database")]
pub mod database;

use thiserror::Error;

#[derive(Error, Debug)]
pub enum ServiceError {
    #[error("cache error")]
    #[cfg(feature = "cache")]
    Cache(#[from] redis::RedisError),
    #[error("database error")]
    #[cfg(feature = "database")]
    Database(#[from] sqlx::Error),
    #[error("the data for key `{0}` is not available")]
    Redaction(String),
    #[error("invalid header (expected {expected:?}, found {found:?})")]
    InvalidHeader { expected: String, found: String },
    #[error("unknown data store error")]
    Unknown,
}