1use std::{path::PathBuf, string::FromUtf8Error};
2
3#[derive(Debug, thiserror::Error)]
5#[non_exhaustive]
6pub enum Error {
7 #[error("ALPM type parse error: {0}")]
9 AlpmType(#[from] alpm_types::Error),
10
11 #[error("I/O error at path {0:?} while {1}:\n{2}")]
13 IoPathError(PathBuf, &'static str, std::io::Error),
14
15 #[error("Read error while {context}:\n{source}")]
17 IoReadError {
18 context: &'static str,
22 source: std::io::Error,
24 },
25
26 #[error(transparent)]
28 InvalidUTF8(#[from] FromUtf8Error),
29
30 #[error("Failed to deserialize PKGINFO file:\n{0}")]
32 DeserializeError(#[from] alpm_parsers::custom_ini::Error),
33
34 #[error("Extra data field is specified without any value")]
36 ExtraDataEmpty,
37
38 #[error("The first extra data definition does not specify \"pkgtype\"")]
40 FirstExtraDataNotPkgType,
41
42 #[error("No input file given.")]
44 NoInputFile,
45
46 #[error("JSON error: {0}")]
48 Json(#[from] serde_json::Error),
49
50 #[error("Invalid variant ({0})")]
52 InvalidVariant(#[from] strum::ParseError),
53
54 #[error("Extra data is missing.")]
56 MissingExtraData,
57
58 #[error("Unsupported schema version: {0}")]
60 UnsupportedSchemaVersion(String),
61}