1use thiserror::Error;
2
3#[derive(Error, Debug, Clone)]
4pub enum SourceError {
5 #[error("HTTP request failed: {0}")]
6 HttpError(String),
7
8 #[error("Platform rate limit reached")]
9 RateLimited,
10
11 #[error("Unsupported music quality")]
12 UnsupportedQuality,
13
14 #[error("JS execution error: {0}")]
15 ScriptError(String),
16
17 #[error("Platform parser error: {0}")]
18 PlatformError(String),
19
20 #[error("Song not found")]
21 NotFound,
22
23 #[error("No downloadable URL resolved")]
24 NoUrl,
25}
26
27#[derive(Error, Debug)]
28pub enum LuxError {
29 #[error("Source error: {0}")]
30 Source(#[from] SourceError),
31
32 #[error("Player error: {0}")]
33 Player(String),
34
35 #[error("Database error: {0}")]
36 Database(String),
37
38 #[error("Download error: {0}")]
39 Download(String),
40
41 #[error("Configuration error: {0}")]
42 Config(String),
43
44 #[error("I/O error: {0}")]
45 Io(String),
46
47 #[error("Unknown error: {0}")]
48 Other(String),
49}
50
51pub type Result<T> = std::result::Result<T, LuxError>;