Skip to main content

cedros_data/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum CedrosDataError {
5    #[error("missing required environment variable POSTGRES_URI")]
6    MissingPostgresUri,
7
8    #[error("site is not configured")]
9    SiteNotConfigured,
10
11    #[error("collection not found: {0}")]
12    CollectionNotFound(String),
13
14    #[error("invalid identifier: {0}")]
15    InvalidIdentifier(String),
16
17    #[error("invalid type expression: {0}")]
18    InvalidTypeExpression(String),
19
20    #[error("schema has breaking changes: {0}")]
21    BreakingSchemaChange(String),
22
23    #[error("contract verification failed: {0}")]
24    ContractVerificationFailed(String),
25
26    #[error("invalid request: {0}")]
27    InvalidRequest(String),
28
29    #[error("database error: {0}")]
30    Database(#[from] sqlx::Error),
31
32    #[error("migration error: {0}")]
33    Migration(#[from] sqlx::migrate::MigrateError),
34
35    #[error("json error: {0}")]
36    Json(#[from] serde_json::Error),
37
38    #[error("io error: {0}")]
39    Io(#[from] std::io::Error),
40
41    #[error("storage error: {0}")]
42    Storage(String),
43}
44
45pub type Result<T> = std::result::Result<T, CedrosDataError>;