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,
19 source: std::io::Error,
20 },
21
22 #[error(transparent)]
24 InvalidUTF8(#[from] FromUtf8Error),
25
26 #[error("Failed to deserialize PKGINFO file:\n{0}")]
28 DeserializeError(#[from] alpm_parsers::custom_ini::Error),
29
30 #[error("Extra data field is specified without any value")]
32 ExtraDataEmpty,
33
34 #[error("The first extra data definition does not specify \"pkgtype\"")]
36 FirstExtraDataNotPkgType,
37
38 #[error("No input file given.")]
40 NoInputFile,
41
42 #[error("JSON error: {0}")]
44 Json(#[from] serde_json::Error),
45
46 #[error("Invalid variant ({0})")]
48 InvalidVariant(#[from] strum::ParseError),
49
50 #[error("Extra data is missing.")]
52 MissingExtraData,
53
54 #[error("Unsupported schema version: {0}")]
56 UnsupportedSchemaVersion(String),
57}