use std::{path::PathBuf, string::FromUtf8Error};
use alpm_types::SchemaVersion;
use thiserror::Error;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("ALPM type parse error: {0}")]
AlpmType(#[from] alpm_types::Error),
#[error("I/O error at path {0:?} while {1}:\n{2}")]
IoPathError(PathBuf, &'static str, std::io::Error),
#[error(transparent)]
InvalidUTF8(#[from] FromUtf8Error),
#[error("Failed to deserialize BUILDINFO file:\n{0}")]
DeserializeError(#[from] alpm_parsers::custom_ini::Error),
#[error("No input file given.")]
NoInputFile,
#[error("Unsupported schema version: {0}")]
UnsupportedSchemaVersion(String),
#[error("Wrong schema version used to create a BUILDINFO: {0}")]
WrongSchemaVersion(SchemaVersion),
#[error("Missing format field")]
MissingFormatField,
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
}