1use std::{path::PathBuf, string::FromUtf8Error};
2
3use fluent_i18n::t;
4
5#[derive(Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum Error {
9 #[error(transparent)]
11 AlpmType(#[from] alpm_types::Error),
12
13 #[error("{msg}", msg = t!("error-io-path", {
15 "path" => path,
16 "context" => context,
17 "source" => source.to_string()
18 }))]
19 IoPathError {
20 path: PathBuf,
24 context: String,
26 source: std::io::Error,
28 },
29
30 #[error("{msg}", msg = t!("error-io-read", {
32 "context" => context,
33 "source" => source.to_string()
34 }))]
35 IoReadError {
36 context: String,
40 source: std::io::Error,
42 },
43
44 #[error(transparent)]
46 InvalidUTF8(#[from] FromUtf8Error),
47
48 #[error("{msg}", msg = t!("error-deserialize", { "source" => source.to_string() }))]
50 DeserializeError {
51 #[from]
53 source: alpm_parsers::custom_ini::Error,
54 },
55
56 #[error("{msg}", msg = t!("error-extra-data-empty"))]
58 ExtraDataEmpty,
59
60 #[error("{msg}", msg = t!("error-first-extra-data-not-pkgtype"))]
62 FirstExtraDataNotPkgType,
63
64 #[error("{msg}", msg = t!("error-invalid-variant", { "error" => 0.to_string() }))]
66 InvalidVariant(#[from] strum::ParseError),
67
68 #[error("{msg}", msg = t!("error-unsupported-schema", { "version" => .0 }))]
70 UnsupportedSchemaVersion(String),
71}