use std::path::PathBuf;
#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum Error {
#[error(
"Can not create a Wick package from directory '{0}'. Please specify a component or application file instead."
)]
Directory(PathBuf),
#[error("Can not create a Wick package from {0}. Please specify a component or application file instead.")]
InvalidWickConfig(String),
#[error("Can not create package with file outside of parent directory scope {0}.")]
InvalidFileLocation(String),
#[error("Target directory {0} not found or not readable.")]
DestinationDir(String),
#[error("Can not find file at {0}.")]
NotFound(String),
#[error("Must specify metadata & version when performing package actions: {0}")]
NoMetadata(String),
#[error("Failed to read downloaded package: {0}")]
PackageReadFailed(String),
#[error("Failed to read file '{0}': {1}")]
ReadFile(PathBuf, #[source] std::io::Error),
#[error("Failed to read file '{}': {1}", .0.display())]
TarFile(PathBuf, #[source] std::io::Error),
#[error("Failed to read file '{0}': {1}")]
GzipFile(PathBuf, #[source] std::io::Error),
#[error("Error in gzip: {0}")]
GzipFailed(#[source] std::io::Error),
#[error("Published components must be named")]
NoName,
#[error("Published components must have a version")]
NoVersion,
#[error(transparent)]
Config(#[from] wick_config::Error),
#[error(transparent)]
Oci(#[from] wick_oci_utils::Error),
#[error(transparent)]
AssetReference(#[from] wick_config::AssetError),
#[error("Could not parse {0} as JSON: {1}")]
InvalidJson(&'static str, #[source] serde_json::Error),
}