inspector_gguf/localization/
error.rs

1use crate::localization::Language;
2use thiserror::Error;
3
4/// Errors that can occur during localization operations
5#[derive(Debug, Error)]
6pub enum LocalizationError {
7    /// Translation file not found for the specified language
8    #[error("Translation file not found for language: {0:?}")]
9    TranslationNotFound(Language),
10
11    /// Invalid translation file format or structure
12    #[error("Invalid translation file format: {0}")]
13    InvalidFormat(String),
14
15    /// Requested translation key not found in the translation data
16    #[error("Translation key not found: {0}")]
17    KeyNotFound(String),
18
19    /// Error occurred in settings management
20    #[error("Settings error: {0}")]
21    Settings(#[from] SettingsError),
22
23    /// Input/output error during file operations
24    #[error("IO error: {0}")]
25    Io(#[from] std::io::Error),
26
27    /// JSON parsing or serialization error
28    #[error("JSON parsing error: {0}")]
29    JsonParsing(#[from] serde_json::Error),
30}
31
32/// Errors that can occur during settings management operations
33#[derive(Debug, Error)]
34pub enum SettingsError {
35    /// Failed to create the settings directory
36    #[error("Failed to create settings directory")]
37    DirectoryCreation,
38
39    /// Failed to read the settings file
40    #[error("Failed to read settings file")]
41    ReadError,
42
43    /// Failed to write to the settings file
44    #[error("Failed to write settings file")]
45    WriteError,
46
47    /// Settings file has invalid format or structure
48    #[error("Invalid settings format")]
49    InvalidFormat,
50
51    /// Input/output error during file operations
52    #[error("IO error: {0}")]
53    Io(#[from] std::io::Error),
54
55    /// JSON parsing or serialization error
56    #[error("JSON parsing error: {0}")]
57    JsonParsing(#[from] serde_json::Error),
58}