Skip to main content

bbdown_core/
error.rs

1use thiserror::Error as ThisError;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, ThisError)]
6pub enum Error {
7    #[error("invalid input: {0}")]
8    InvalidInput(String),
9    #[error("{input_kind} links require an explicit selection in non-interactive mode")]
10    SelectionRequired { input_kind: &'static str },
11    #[error("unsupported input for this release slice: {0}")]
12    Unsupported(String),
13    #[error("API returned code {code}: {message}")]
14    Api { code: i64, message: String },
15    #[error("access restricted: {0}")]
16    AccessRestricted(String),
17    #[error("API response did not contain {0}")]
18    MissingField(&'static str),
19    #[error("failed to parse URL: {0}")]
20    Url(#[from] url::ParseError),
21    #[error("HTTP error: {0}")]
22    Http(#[from] reqwest::Error),
23    #[error("JSON error: {0}")]
24    Json(#[from] serde_json::Error),
25    #[error("I/O error: {0}")]
26    Io(#[from] std::io::Error),
27    #[error("ffmpeg mux failed with status {status}")]
28    MuxFailed { status: String },
29}