forge
Explore
Log in

Don't you dare go Hollow

iz

Clone
★ 0

0 watching0 forksRustAGPL-3.0567.3 KiB3950aceTahinli27 days ago34 commits

error.rs37 lines, 1.3 KiBHistoryRawDownload
1//! The error type shared by iz-core. `Invalid` and `Conflict` carry text that is safe to show the
2//! user; everything else is logged and answered with a generic page.
3
4/// Every failure iz-core reports.
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7 /// Filesystem failure.
8 #[error("io error: {0}")]
9 Io(#[from] std::io::Error),
10 /// A database statement failed.
11 #[error("database error: {0}")]
12 Database(String),
13 /// A migration could not be applied or the history is inconsistent.
14 #[error("migration error: {0}")]
15 Migration(String),
16 /// The configuration file is unreadable or fails validation.
17 #[error("config error: {0}")]
18 Config(String),
19 /// Sealing, opening or the instance key failed.
20 #[error("crypto error: {0}")]
21 Crypto(String),
22 /// The row or resource does not exist, or the viewer may not know that it exists.
23 #[error("not found")]
24 NotFound,
25 /// The request conflicts with the current state (for example a stale move).
26 #[error("conflict: {0}")]
27 Conflict(String),
28 /// The actor may not do this.
29 #[error("forbidden: {0}")]
30 Forbidden(String),
31 /// A value broke a rule the user can fix (length, format, unknown zone).
32 #[error("invalid value: {0}")]
33 Invalid(String),
34}
35
36/// Result alias used across iz-core.
37pub type Result<T> = std::result::Result<T, Error>;