1use std::{io, num, path};
7use thiserror::Error as DeriveError;
8
9#[derive(Debug, DeriveError)]
11#[non_exhaustive]
12pub enum Error {
13 #[error("{0}")]
15 Resource(#[from] tauri_utils::Error),
16 #[error("{0:#}")]
18 BundlerError(#[from] anyhow::Error),
19 #[error("`{0}`")]
21 IoError(#[from] io::Error),
22 #[error("`{0}`")]
24 ImageError(#[from] image::ImageError),
25 #[error("`{0}`")]
27 WalkdirError(#[from] walkdir::Error),
28 #[error("`{0}`")]
30 StripError(#[from] path::StripPrefixError),
31 #[error("`{0}`")]
33 ConvertError(#[from] num::TryFromIntError),
34 #[error("`{0}`")]
36 ZipError(#[from] zip::result::ZipError),
37 #[error("`{0}`")]
39 HexError(#[from] hex::FromHexError),
40 #[error("`{0}`")]
42 HandleBarsError(#[from] handlebars::RenderError),
43 #[error("`{0}`")]
45 JsonError(#[from] serde_json::error::Error),
46 #[cfg(any(target_os = "macos", windows))]
48 #[error("`{0}`")]
49 RegexError(#[from] regex::Error),
50 #[error("`{0}`")]
52 HttpError(#[from] Box<ureq::Error>),
53 #[cfg(windows)]
55 #[error("{0}")]
56 GlobPattern(#[from] glob::PatternError),
57 #[cfg(windows)]
59 #[error("`{0}`")]
60 Glob(#[from] glob::GlobError),
61 #[error("`{0}`")]
63 UrlParse(#[from] url::ParseError),
64 #[error("hash mismatch of downloaded file")]
66 HashError,
67 #[error("Architecture Error: `{0}`")]
69 ArchError(String),
70 #[error("Could not find Icon paths. Please make sure they exist in the tauri config JSON file")]
72 IconPathError,
73 #[error("Could not find background file. Make sure it exists in the tauri config JSON file and extension is png/jpg/gif")]
75 BackgroundPathError,
76 #[error("Path Error:`{0}`")]
78 PathUtilError(String),
79 #[error("Shell Scripting Error:`{0}`")]
81 ShellScriptError(String),
82 #[error("`{0}`")]
84 GenericError(String),
85 #[error("Unable to find a bundled project for the updater")]
87 UnableToFindProject,
88 #[error("string is not UTF-8")]
90 Utf8(#[from] std::str::Utf8Error),
91 #[error("SignTool not found")]
93 SignToolNotFound,
94 #[error("failed to open registry {0}")]
96 OpenRegistry(String),
97 #[error("failed to get {0} value on registry")]
99 GetRegistryValue(String),
100 #[error("failed to enumerate registry keys")]
102 FailedToEnumerateRegKeys,
103 #[error("unsupported OS bitness")]
105 UnsupportedBitness,
106 #[error("failed to sign app: {0}")]
108 Sign(String),
109 #[cfg(target_os = "macos")]
111 #[error("`{0}`")]
112 TimeError(#[from] time::error::Error),
113 #[cfg(target_os = "macos")]
115 #[error(transparent)]
116 Plist(#[from] plist::Error),
117 #[cfg(target_os = "linux")]
119 #[error("{0}")]
120 RpmError(#[from] rpm::Error),
121}
122
123pub type Result<T> = std::result::Result<T, Error>;