use std::{str::Utf8Error, string::FromUtf8Error};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Invalid arguments: {0}")]
InvalidArguments(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Execution failure: {0}")]
ExecutionFailure(String),
#[error("Object read error: {0}")]
ObjectReadError(#[from] object::read::Error),
#[error("Object write error: {0}")]
ObjectWriteError(#[from] object::write::Error),
#[error("String error: {0}")]
StringError(String),
#[error("Unsupported binary format: {0}")]
UnsupportedBinaryFormat(String),
#[error("Missing file: {0}")]
MissingFile(String),
#[error("Configuration error: {0}")]
ConfigError(String),
#[error("Unknown error: {0}")]
Unknown(String),
}
impl From<Utf8Error> for Error {
fn from(value: Utf8Error) -> Self {
Self::StringError(format!("{}", value))
}
}
impl From<FromUtf8Error> for Error {
fn from(value: FromUtf8Error) -> Self {
Self::StringError(format!("{}", value))
}
}