/
error.rs
78 lines (77 loc) · 2.28 KB
/
error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
/// The error types.
#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum Error {
/// Command error.
#[error("Command Error: {0}")]
Command(String),
/// The path operation error.
#[error("Path Error: {0}")]
Path(String),
/// The path StripPrefixError error.
#[error("Path Error: {0}")]
PathPrefix(#[from] std::path::StripPrefixError),
/// Error showing the dialog.
#[error("Dialog Error: {0}")]
Dialog(String),
/// The dialog operation was cancelled by the user.
#[error("user cancelled the dialog")]
DialogCancelled,
/// The network error.
#[error("Network Error: {0}")]
Network(#[from] reqwest::Error),
/// Invalid HTTP header value.
#[error(transparent)]
HttpHeaderValue(#[from] http::header::InvalidHeaderValue),
/// Invalid HTTP header value.
#[error(transparent)]
HttpHeader(#[from] http::header::InvalidHeaderName),
/// Failed to convert bytes to string.
#[error(transparent)]
Utf8(#[from] std::string::FromUtf8Error),
/// HTTP form to must be an object.
#[error("http form must be an object")]
InvalidHttpForm,
/// Semver error.
#[error(transparent)]
Semver(#[from] semver::Error),
/// JSON error.
#[error(transparent)]
Json(#[from] serde_json::Error),
/// IO error.
#[error(transparent)]
Io(#[from] std::io::Error),
/// Ignore error.
#[error("failed to walkdir: {0}")]
Ignore(#[from] ignore::Error),
/// ZIP error.
#[cfg(feature = "fs-extract-api")]
#[error(transparent)]
Zip(#[from] zip::result::ZipError),
/// Extract error.
#[cfg(feature = "fs-extract-api")]
#[error("Failed to extract: {0}")]
Extract(String),
/// Notification error.
#[cfg(notification_all)]
#[error(transparent)]
Notification(#[from] notify_rust::error::Error),
/// Url error.
#[error(transparent)]
Url(#[from] url::ParseError),
/// failed to detect the current platform.
#[error("failed to detect platform: {0}")]
FailedToDetectPlatform(String),
/// Shell error.
#[error("shell error: {0}")]
Shell(String),
/// Unknown program name.
#[error("unknown program name: {0}")]
UnknownProgramName(String),
/// HTTP error.
#[error(transparent)]
Http(#[from] http::Error),
}