Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: print more error causes #3475

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/fluvio-auth/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use thiserror::Error;
/// Possible errors from Auth
#[derive(Error, Debug)]
pub enum AuthError {
#[error("IoError")]
#[error("IoError: {0}")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's get rid of this and move to anyhow

Copy link
Contributor Author

@ozgrakkurt ozgrakkurt Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to do anyhow, but then it requires changes in other places in the code. Want to make this change like this and do other PRs for anyhow in future.

This should still print relevant info for now

IoError(#[from] IoError),
}

impl From<AuthError> for IoError {
fn from(e: AuthError) -> Self {
match e {
AuthError::IoError(source) => source,
match &e {
AuthError::IoError(source) => IoError::new(source.kind(), e),
}
}
}
2 changes: 1 addition & 1 deletion crates/fluvio-channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub const FLUVIO_IMAGE_TAG_STRATEGY: &str = "FLUVIO_IMAGE_TAG_STRATEGY";
pub enum ChannelConfigError {
#[error(transparent)]
ConfigFileError(#[from] IoError),
#[error("Failed to deserialize Fluvio config")]
#[error("Failed to deserialize Fluvio config: {0}")]
TomlError(#[from] toml::de::Error),
}
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)]
Expand Down
20 changes: 10 additions & 10 deletions crates/fluvio-cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ use crate::common::target::TargetError;
pub enum CliError {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this and move to anyhow

#[error(transparent)]
OutputError(#[from] OutputError),
#[error("Failed to parse format string")]
#[error("Failed to parse format string: {0}")]
TemplateError(#[from] TemplateError),

#[cfg(feature = "k8s")]
#[error("Fluvio cluster error")]
#[error("Fluvio cluster error: {0}")]
ClusterCliError(#[from] ClusterCliError),

#[error("Target Error")]
#[error("Target Error: {0}")]
TargetError(#[from] TargetError),
#[error("Fluvio client error")]
#[error("Fluvio client error: {0}")]
ClientError(#[from] FluvioError),

#[cfg(feature = "k8s")]
#[error("Kubernetes config error")]
#[error("Kubernetes config error: {0}")]
K8ConfigError(#[from] k8_config::ConfigError),

#[cfg(feature = "k8s")]
#[error("Kubernetes client error")]
#[error("Kubernetes client error: {0}")]
K8ClientError(#[from] k8_client::ClientError),

/// An error occurred while processing the connector yaml
#[error("Fluvio connector config")]
#[error("Fluvio connector config: {0}")]
ConnectorConfig(#[from] serde_yaml::Error),

#[error("Package index error")]
#[error("Package index error: {0}")]
IndexError(#[from] fluvio_index::Error),
#[error("Error finding executable")]
#[error("Error finding executable: {0}")]
WhichError(#[from] which::Error),
#[error("Http Error: {0}")]
HttpError(#[from] fluvio_cli_common::error::HttpError),
Expand All @@ -65,7 +65,7 @@ pub enum CliError {
DataPlaneError(#[from] ErrorCode),
#[error("TableFormat not found: {0}")]
TableFormatNotFound(String),
#[error("Not active profile set in config")]
#[error("No active profile set in config")]
NoActiveProfileInConfig,
#[error("Profile not found in config: {0}")]
ProfileNotFoundInConfig(String),
Expand Down
42 changes: 21 additions & 21 deletions crates/fluvio-cluster/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,35 @@ use crate::runtime::local::LocalRuntimeError;
#[derive(thiserror::Error, Debug)]
pub enum ClusterError {
/// An error occurred while trying to install Fluvio on Kubernetes
#[error("Failed to install Fluvio on Kubernetes")]
#[error("Failed to install Fluvio on Kubernetes: {0}")]
InstallK8(#[from] K8InstallError),
/// An error occurred while trying to install Fluvio locally
#[error("Failed to install Fluvio locally")]
#[error("Failed to install Fluvio locally: {0}")]
InstallLocal(#[from] LocalInstallError),
/// An error occurred while trying to install Fluvio system charts
#[error("Failed to install Fluvio system charts")]
#[error("Failed to install Fluvio system charts: {0}")]
InstallSys(#[from] ChartInstallError),
/// An error occurred while trying to uninstall Fluvio
#[error("Failed to uninstall Fluvio")]
#[error("Failed to uninstall Fluvio: {0}")]
Uninstall(#[from] UninstallError),
#[error("Progress Error")]
#[error("Progress Error: {0}")]
ProgressError(#[from] TemplateError),
}

/// Errors that may occur while trying to install Fluvio on Kubernetes
#[derive(thiserror::Error, Debug)]
pub enum K8InstallError {
/// An error occurred with the Kubernetes config.
#[error("Kubernetes config error")]
#[error("Kubernetes config error: {0}")]
K8ConfigError(#[from] K8ConfigError),
/// An error occurred with the Kubernetes client.
#[error("Kubernetes client error")]
#[error("Kubernetes client error: {0}")]
K8ClientError(#[from] K8ClientError),
/// An error occurred while running helm.
#[error("Helm client error")]
#[error("Helm client error: {0}")]
HelmError(#[from] HelmError),
/// An error occurred while running helm.
#[error("Helm Chart error")]
#[error("Helm Chart error: {0}")]
ChartError(#[from] ChartInstallError),
/// Failed to execute a command
#[error(transparent)]
Expand All @@ -58,7 +58,7 @@ pub enum K8InstallError {
#[error("Failed to perform one or more pre-checks")]
PrecheckErrored(CheckResults),
/// Failed to update Fluvio cluster
#[error("Expected to find cluster with platform version {0}")]
#[error("Expected to find cluster with platform version: {0}")]
FailedPlatformVersion(String),
/// Timed out when waiting for SC service.
#[error("Timed out when waiting for SC service")]
Expand Down Expand Up @@ -88,12 +88,12 @@ pub enum K8InstallError {
#[error("Missing required config option {0}")]
MissingRequiredConfig(String),
/// Kubectl not found
#[error("kubectl not found")]
#[error("kubectl not found: {0}")]
KubectlNotFoundError(IoError),
/// Kubectl not found
#[error("Port forwarding process exited with code: {0}")]
PortForwardingFailed(ExitStatus),
#[error("Progress Error")]
#[error("Progress Error: {0}")]
ProgressError(#[from] TemplateError),
}

Expand All @@ -110,16 +110,16 @@ pub enum LocalInstallError {
#[error(transparent)]
IoError(#[from] IoError),
/// An error occurred with the Fluvio client.
#[error("Fluvio client error")]
#[error("Fluvio client error: {0}")]
FluvioError(#[from] FluvioError),
/// An error occurred with the Kubernetes config.
#[error("Kubernetes config error")]
#[error("Kubernetes config error: {0}")]
K8ConfigError(#[from] K8ConfigError),
/// An error occurred with the Kubernetes client.
#[error("Kubernetes client error")]
#[error("Kubernetes client error: {0}")]
K8ClientError(#[from] K8ClientError),
/// An error occurred while running helm.
#[error("Helm client error")]
#[error("Helm client error: {0}")]
HelmError(#[from] HelmError),
/// Failed to execute a command
#[error(transparent)]
Expand Down Expand Up @@ -160,7 +160,7 @@ pub enum LocalInstallError {
Other(String),
#[error(transparent)]
ClusterCheckError(#[from] ClusterCheckError),
#[error("Progress Error")]
#[error("Progress Error: {0}")]
ProgressError(#[from] TemplateError),
}

Expand All @@ -171,19 +171,19 @@ pub enum UninstallError {
#[error(transparent)]
IoError(#[from] IoError),
/// An error occurred with the Fluvio client.
#[error("Fluvio client error")]
#[error("Fluvio client error: {0}")]
FluvioError(#[from] FluvioError),
/// Failed to execute a command
#[error(transparent)]
CommandError(#[from] CommandError),
/// An error occurred with the Kubernetes config.
#[error("Kubernetes config error")]
#[error("Kubernetes config error: {0}")]
K8ConfigError(#[from] K8ConfigError),
/// An error occurred with the Kubernetes client.
#[error("Kubernetes client error")]
#[error("Kubernetes client error: {0}")]
K8ClientError(#[from] K8ClientError),
/// An error occurred while running helm.
#[error("Helm client error")]
#[error("Helm client error: {0}")]
HelmError(#[from] HelmError),
/// Timed out when waiting for SC service.
#[error("Timed out when waiting for SC service")]
Expand Down
Loading