1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
use std::io::Error as IoError; use thiserror::Error; use fluvio::FluvioError; use fluvio_cluster::ClusterError; #[derive(Error, Debug)] pub enum CliError { #[error(transparent)] IoError { #[from] source: IoError, }, #[error("Fluvio client error")] ClientError { #[from] source: FluvioError, }, #[error("Fluvio cluster error")] ClusterError { #[from] source: ClusterError, }, #[error("Kubernetes config error")] K8ConfigError { #[from] source: k8_config::ConfigError, }, #[error("Kubernetes client error")] K8ClientError { #[from] source: k8_client::ClientError, }, #[error("Invalid argument: {0}")] InvalidArg(String), #[error("Error finding executable")] WhichError { #[from] source: which::Error, }, #[error("Unknown error: {0}")] Other(String), } impl CliError { pub fn invalid_arg<M: Into<String>>(reason: M) -> Self { Self::InvalidArg(reason.into()) } }