1use std::{path::PathBuf, string::FromUtf8Error};
4
5use alpm_types::MetadataFileName;
6use fluent_i18n::t;
7
8#[derive(Debug, thiserror::Error)]
10pub enum Error {
11 #[error(transparent)]
13 AlpmBuildInfo(#[from] alpm_buildinfo::Error),
14
15 #[error(transparent)]
17 AlpmCommon(#[from] alpm_common::Error),
18
19 #[error(transparent)]
21 AlpmMtree(#[from] alpm_mtree::Error),
22
23 #[error(transparent)]
25 AlpmMtreePathValidation(#[from] alpm_mtree::mtree::path_validation_error::PathValidationError),
26
27 #[error(transparent)]
29 AlpmPackageInfo(#[from] alpm_pkginfo::Error),
30
31 #[error(transparent)]
33 AlpmTypes(#[from] alpm_types::Error),
34
35 #[error(transparent)]
37 AlpmTypesPackage(#[from] alpm_types::PackageError),
38
39 #[error(transparent)]
41 AlpmCompress(#[from] alpm_compress::Error),
42
43 #[error("{msg}", msg = t!("error-install-scriptlet", {
47 "path" => path,
48 "context" => context
49 }))]
50 InstallScriptlet {
51 path: PathBuf,
53 context: String,
58 },
59
60 #[error("{msg}", msg = t!("error-package-input", { "source" => 0.to_string() }))]
62 Input(#[from] crate::input::Error),
63
64 #[error("{msg}", msg = t!("error-input-dir-is-output-dir", { "path" => path }))]
66 InputDirIsOutputDir {
67 path: PathBuf,
69 },
70
71 #[error("{msg}", msg = t!("error-input-dir-in-output-dir", {
73 "input_path" => input_path,
74 "output_path" => output_path,
75 }))]
76 InputDirInOutputDir {
77 input_path: PathBuf,
79 output_path: PathBuf,
81 },
82
83 #[error("{msg}", msg = t!("error-io-path", {
85 "path" => path,
86 "context" => context,
87 "source" => source.to_string()
88 }))]
89 IoPath {
90 path: PathBuf,
92 context: String,
96 source: std::io::Error,
98 },
99
100 #[error("{msg}", msg = t!("error-io-read", {
102 "context" => context,
103 "source" => source.to_string()
104 }))]
105 IoRead {
106 context: String,
110 source: std::io::Error,
112 },
113
114 #[error("{msg}", msg = t!("error-invalid-utf8", {
116 "context" => context,
117 "source" => source.to_string()
118 }))]
119 InvalidUTF8 {
120 context: String,
124 source: FromUtf8Error,
126 },
127
128 #[error("{msg}", msg = t!("error-metadata-not-found", { "name" => name.to_string() }))]
130 MetadataFileNotFound {
131 name: MetadataFileName,
133 },
134
135 #[error("{msg}", msg = t!("error-end-of-entries"))]
137 EndOfPackageEntries,
138
139 #[error("{msg}", msg = t!("error-output-dir-in-input-dir", {
141 "input_path" => input_path,
142 "output_path" => output_path
143 }))]
144 OutputDirInInputDir {
145 input_path: PathBuf,
147 output_path: PathBuf,
149 },
150
151 #[error("{msg}", msg = t!("error-package", { "source" => .0.to_string() }))]
153 Package(#[from] crate::package::Error),
154
155 #[error("{msg}", msg = t!("error-path-not-exist", { "path" => path }))]
157 PathDoesNotExist {
158 path: PathBuf,
160 },
161
162 #[error("{msg}", msg = t!("error-path-no-parent", { "path" => path }))]
164 PathHasNoParent {
165 path: PathBuf,
167 },
168
169 #[error("{msg}", msg = t!("error-path-not-file", { "path" => path }))]
171 PathIsNotAFile {
172 path: PathBuf,
174 },
175
176 #[error("{msg}", msg = t!("error-path-read-only", { "path" => path }))]
178 PathIsReadOnly {
179 path: PathBuf,
181 },
182}