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 IoPath {
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 IoRead {
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" => .0.to_string() }))]
51 Deserialization(#[from] alpm_parsers::custom_ini::Error),
52
53 #[error("{msg}", msg = t!("error-extra-data-empty"))]
55 ExtraDataEmpty,
56
57 #[error("{msg}", msg = t!("error-first-extra-data-not-pkgtype"))]
59 FirstExtraDataNotPkgType,
60
61 #[error("{msg}", msg = t!("error-invalid-variant", { "error" => .0.to_string() }))]
63 InvalidVariant(#[from] strum::ParseError),
64
65 #[error("{msg}", msg = t!("error-unsupported-schema", { "version" => .0 }))]
67 UnsupportedSchemaVersion(String),
68}