app_info/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum AppInfoError {
5    #[error("Failed to read applications directory: {0}")]
6    DirectoryReadError(#[from] std::io::Error),
7    
8    #[error("Failed to parse application bundle: {path}")]
9    BundleParseError { path: String },
10    
11    #[error("Failed to read Info.plist: {0}")]
12    PlistError(String),
13    
14    #[error("Registry access error: {0}")]
15    RegistryError(String),
16    
17    #[error("Application not found: {name}")]
18    AppNotFound { name: String },
19    
20    #[error("Unsupported platform")]
21    UnsupportedPlatform,
22    
23    #[error("Failed to get file icon: {0}")]
24    FileIconError(#[from] FileIconError),
25}
26
27#[derive(Error, Debug)]
28pub enum FileIconError {
29    #[error("Path does not exist")]
30    PathDoesNotExist,
31    
32    #[error("Icon size cannot be zero")]
33    NullIconSize,
34    
35    #[error("Failed to extract icon")]
36    Failed,
37    
38    #[error("Platform not supported")]
39    PlatformNotSupported,
40}
41
42pub type Result<T> = std::result::Result<T, AppInfoError>;