Skip to main content

nzb_core/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum NzbError {
5    #[error("NZB parse error: {0}")]
6    ParseError(String),
7
8    #[error("Invalid NZB: {0}")]
9    InvalidNzb(String),
10
11    #[error("Job not found: {0}")]
12    JobNotFound(String),
13
14    #[error("Server not found: {0}")]
15    ServerNotFound(String),
16
17    #[error("Category not found: {0}")]
18    CategoryNotFound(String),
19
20    #[error("Database error: {0}")]
21    Database(#[from] rusqlite::Error),
22
23    #[error("IO error: {0}")]
24    Io(#[from] std::io::Error),
25
26    #[error("Config error: {0}")]
27    Config(String),
28
29    #[error("NNTP error: {0}")]
30    Nntp(String),
31
32    #[error("Decode error: {0}")]
33    Decode(String),
34
35    #[error("Post-processing error: {0}")]
36    PostProc(String),
37
38    #[error("{0}")]
39    Other(String),
40}
41
42pub type Result<T> = std::result::Result<T, NzbError>;