1use std::{path::PathBuf, string::FromUtf8Error};
2
3use alpm_types::SchemaVersion;
4use fluent_i18n::t;
5
6#[derive(Debug, thiserror::Error)]
8#[non_exhaustive]
9pub enum Error {
10 #[error("{msg}", msg = t!("error-alpm-type", { "source" => .0.to_string() }))]
12 AlpmType(#[from] alpm_types::Error),
13
14 #[error("{msg}", msg = t!("error-io-path", {
16 "path" => path.display().to_string(),
17 "context" => context,
18 "source" => source.to_string()
19 }))]
20 IoPathError {
21 path: PathBuf,
23 context: String,
27 source: std::io::Error,
29 },
30
31 #[error("{msg}", msg = t!("error-io-read", {
33 "context" => context,
34 "source" => source.to_string()
35 }))]
36 IoReadError {
37 context: String,
41 source: std::io::Error,
43 },
44
45 #[error(transparent)]
47 InvalidUTF8(#[from] FromUtf8Error),
48
49 #[error("{msg}", msg = t!("error-deserialize-buildinfo", { "source" => .0.to_string() }))]
51 DeserializeError(#[from] alpm_parsers::custom_ini::Error),
52
53 #[error("Unsupported schema version: {0}")]
55 UnsupportedSchemaVersion(String),
56
57 #[error("{msg}", msg = t!("error-wrong-schema-version", { "version" => .0.to_string() }))]
59 WrongSchemaVersion(SchemaVersion),
60
61 #[error("{msg}", msg = t!("error-missing-format-field"))]
63 MissingFormatField,
64}