1use thiserror::Error;
2
3#[derive(Debug, Error)]
5pub enum RouchError {
6 #[error("not found: {0}")]
7 NotFound(String),
8
9 #[error("conflict: document update conflict")]
10 Conflict,
11
12 #[error("bad request: {0}")]
13 BadRequest(String),
14
15 #[error("unauthorized")]
16 Unauthorized,
17
18 #[error("forbidden: {0}")]
19 Forbidden(String),
20
21 #[error("invalid revision format: {0}")]
22 InvalidRev(String),
23
24 #[error("missing document id")]
25 MissingId,
26
27 #[error("database already exists: {0}")]
28 DatabaseExists(String),
29
30 #[error("database error: {0}")]
31 DatabaseError(String),
32
33 #[error("io error: {0}")]
34 Io(#[from] std::io::Error),
35
36 #[error("json error: {0}")]
37 Json(#[from] serde_json::Error),
38}
39
40pub type Result<T> = std::result::Result<T, RouchError>;