Skip to main content

rolter_core/
error.rs

1use thiserror::Error;
2
3/// Top-level error type shared across rolter crates.
4#[derive(Debug, Error)]
5pub enum Error {
6    #[error("io error: {0}")]
7    Io(#[from] std::io::Error),
8
9    #[error("toml parse error: {0}")]
10    Toml(#[from] toml::de::Error),
11
12    #[error("config error: {0}")]
13    Config(String),
14
15    #[error("upstream error: {0}")]
16    Upstream(String),
17
18    #[error("not found: {0}")]
19    NotFound(String),
20
21    #[error("unauthorized")]
22    Unauthorized,
23}
24
25/// Convenience alias for results that fail with [`Error`].
26pub type Result<T> = std::result::Result<T, Error>;