wick_component_cli/
error.rs1use thiserror::Error;
2use wick_interface_types::Type;
3
4#[derive(Error, Debug)]
5#[non_exhaustive]
7pub enum CliError {
8 #[error(transparent)]
9 #[cfg(any(feature = "grpc", feature = "mesh"))]
10 RpcError(#[from] wick_rpc::Error),
12
13 #[error(transparent)]
14 IpAddrError(#[from] std::net::AddrParseError),
16
17 #[error(transparent)]
18 IOError(#[from] std::io::Error),
20
21 #[cfg(feature = "grpc")]
22 #[error(transparent)]
23 Config(#[from] wick_config::AssetError),
25
26 #[error(transparent)]
27 #[cfg(feature = "grpc")]
28 TransportError(#[from] tonic::transport::Error),
30
31 #[error(transparent)]
32 JoinError(#[from] tokio::task::JoinError),
34
35 #[error("invalid argument: {0}")]
36 InvalidArgument(String),
38
39 #[error("Input '{0}' not found in signature")]
40 InvalidInput(String),
42
43 #[error("{0}")]
44 Configuration(String),
46
47 #[error("Could not convert data '{data}' to a format suitable for port {port}'s type {ty}")]
48 Encoding {
50 data: String,
52 port: String,
54 ty: Type,
56 },
57
58 #[error("Found argument '{0}' which requires a value but no value was supplied")]
59 MissingArgumentValue(String),
61}
62
63impl CliError {
64 pub(crate) fn encoding<T: Into<String>, D: Into<String>>(port: T, data: D, ty: Type) -> Self {
65 Self::Encoding {
66 data: data.into(),
67 port: port.into(),
68 ty,
69 }
70 }
71}