Skip to main content

rip_settings/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum SettingsError {
5    #[error("IO error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("Serialization error: {0}")]
9    Serialization(#[from] serde_json::Error),
10
11    #[error("Unknown field: {0}")]
12    UnknownField(String),
13
14    #[error("Validation failed: {0}")]
15    ValidationFailed(String),
16
17    #[error("App ID mismatch: expected {expected}, got {actual}")]
18    AppMismatch { expected: String, actual: String },
19
20    #[error("Schema version {actual} is newer than supported {supported}")]
21    VersionTooNew { actual: u32, supported: u32 },
22
23    #[error("Checksum mismatch - file may be corrupted")]
24    ChecksumMismatch,
25
26    #[error("Parse error: {0}")]
27    ParseError(String),
28
29    #[error("Lock error: {0}")]
30    LockError(String),
31
32    #[error("PIN must be at least {min_length} characters")]
33    PinTooShort { min_length: usize },
34
35    #[error("Invalid PIN")]
36    InvalidPin,
37
38    #[error("Backend error: {0}")]
39    Backend(String),
40
41    #[error("Lock poisoned: {0}")]
42    LockPoisoned(String),
43}