1use std::path::PathBuf;
2
3#[derive(thiserror::Error, Debug)]
5#[non_exhaustive]
6pub enum Error {
7 #[error(
9 "Can not create a Wick package from directory '{0}'. Please specify a component or application file instead."
10 )]
11 Directory(PathBuf),
12
13 #[error("Can not create a Wick package from {0}. Please specify a component or application file instead.")]
15 InvalidWickConfig(String),
16
17 #[error("Can not create package with file outside of parent directory scope {0}.")]
19 InvalidFileLocation(String),
20
21 #[error("Target directory {0} not found or not readable.")]
23 DestinationDir(String),
24
25 #[error("Can not find file at {0}.")]
27 NotFound(String),
28
29 #[error("Must specify metadata & version when performing package actions: {0}")]
31 NoMetadata(String),
32
33 #[error("Failed to read downloaded package: {0}")]
35 PackageReadFailed(String),
36
37 #[error("Failed to read file '{0}': {1}")]
39 ReadFile(PathBuf, #[source] std::io::Error),
40
41 #[error("Failed to read file '{}': {1}", .0.display())]
43 TarFile(PathBuf, #[source] std::io::Error),
44
45 #[error("Failed to read file '{0}': {1}")]
47 GzipFile(PathBuf, #[source] std::io::Error),
48
49 #[error("Error in gzip: {0}")]
51 GzipFailed(#[source] std::io::Error),
52
53 #[error("Published components must be named")]
55 NoName,
56
57 #[error("Published components must have a version")]
59 NoVersion,
60
61 #[error(transparent)]
63 Config(#[from] wick_config::Error),
64
65 #[error(transparent)]
67 Oci(#[from] wick_oci_utils::Error),
68
69 #[error(transparent)]
71 AssetReference(#[from] wick_config::AssetError),
72
73 #[error("Could not parse {0} as JSON: {1}")]
75 InvalidJson(&'static str, #[source] serde_json::Error),
76}