1use std::path::PathBuf;
4
5#[derive(Debug, thiserror::Error)]
7pub enum Error {
8 #[error("invalid language code: {0} (must be 3 lowercase ASCII letters)")]
10 InvalidLangCode(String),
11
12 #[error("invalid feature bundle: {0}")]
14 InvalidFeatureBundle(String),
15
16 #[error("malformed entry at line {line}: {reason}")]
18 MalformedEntry { line: usize, reason: String },
19
20 #[error("language not found: {0}")]
22 LanguageNotFound(String),
23
24 #[error("download failed: {0}")]
26 DownloadFailed(String),
27
28 #[error("GitHub API rate limit exceeded, try again later")]
30 RateLimited,
31
32 #[error("decompression failed: {0}")]
34 DecompressionFailed(String),
35
36 #[error("database error: {0}")]
38 Database(#[from] rusqlite::Error),
39
40 #[error("I/O error: {0}")]
42 Io(#[from] std::io::Error),
43
44 #[error("HTTP error: {0}")]
46 Http(#[from] reqwest::Error),
47
48 #[error("cache directory error: {path}: {reason}")]
50 CacheDir { path: PathBuf, reason: String },
51
52 #[error("JSON error: {0}")]
54 Json(#[from] serde_json::Error),
55}
56
57pub type Result<T> = std::result::Result<T, Error>;