tree_sitter_language_pack/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
9pub enum Error {
10 #[error("Language '{0}' not found")]
11 LanguageNotFound(String),
12
13 #[error("Dynamic library load error: {0}")]
14 DynamicLoad(String),
15
16 #[error("Language function returned null pointer for '{0}'")]
17 NullLanguagePointer(String),
18
19 #[error("Failed to set parser language: {0}")]
20 ParserSetup(String),
21
22 #[error("Registry lock poisoned: {0}")]
23 LockPoisoned(String),
24
25 #[error("Configuration error: {0}")]
26 Config(String),
27
28 #[error("Parse failed: parsing returned no tree")]
29 ParseFailed,
30
31 #[error("Query error: {0}")]
32 QueryError(String),
33
34 #[error("Invalid byte range: {0}")]
35 InvalidRange(String),
36
37 #[error("IO error: {0}")]
38 Io(#[from] std::io::Error),
39
40 #[cfg(any(feature = "config", feature = "download"))]
41 #[error("JSON parse error: {0}")]
42 Json(#[from] serde_json::Error),
43
44 #[cfg(feature = "config")]
45 #[error("TOML parse error: {0}")]
46 Toml(#[from] toml::de::Error),
47
48 #[cfg(feature = "download")]
49 #[error("Download error: {0}")]
50 Download(String),
51
52 #[cfg(feature = "download")]
53 #[error("Checksum mismatch for '{file}': expected {expected}, got {actual}")]
54 ChecksumMismatch {
55 file: String,
56 expected: String,
57 actual: String,
58 },
59}