Skip to content

Commit debb9e8

Browse files
authored
fix: Remove colons from error messages (#300)
* Remove colons from error messages The snafu report cleans up error messages by removing any content after a colon is encoutered in the error message. This also messes up the output of structs when the Debug output is used. This was causing an issue when we failed to resolve a GVK. * Update changelog * Update generated TypeScript schema
1 parent ec5e369 commit debb9e8

File tree

9 files changed

+26
-10
lines changed

9 files changed

+26
-10
lines changed

rust/helm-sys/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ enum Error {
1313
#[snafu(display("Failed to find env var"))]
1414
EnvVarNotFound { source: VarError },
1515

16-
#[snafu(display("Unsupported GOARCH: {arch}"))]
16+
#[snafu(display("Unsupported GOARCH ({arch})"))]
1717
UnsupportedGoArch { arch: String },
1818

19-
#[snafu(display("Unsupported GOOS: {os}"))]
19+
#[snafu(display("Unsupported GOOS ({os})"))]
2020
UnsupportedGoOs { os: String },
2121
}
2222

rust/stackable-cockpit/src/engine/kind/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ pub enum Error {
3030
#[snafu(display("failed to run kind command"))]
3131
CommandFailedToRun { source: std::io::Error },
3232

33-
#[snafu(display("kind command executed, but returned error: {error}"))]
33+
#[snafu(display("failed to successfuly run kind command ({error})"))]
3434
CommandErroredOut { error: String },
3535

36-
#[snafu(display("missing required binary: {binary}"))]
36+
#[snafu(display("missing required binary {binary:?}"))]
3737
MissingBinary { binary: String },
3838

3939
#[snafu(display("failed to determine if Docker is running"))]

rust/stackable-cockpit/src/engine/minikube/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub enum Error {
1717
cluster_name: String,
1818
},
1919

20-
#[snafu(display("missing required binary: {binary}"))]
20+
#[snafu(display("missing required binary {binary:?}"))]
2121
MissingBinary { binary: String },
2222

2323
#[snafu(display("failed to execute Minikube command"))]

rust/stackable-cockpit/src/helm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ pub enum Error {
6363
#[snafu(display("failed to add Helm repo ({error})"))]
6464
AddRepo { error: String },
6565

66-
#[snafu(display("failed to list Helm releases: {error}"))]
66+
#[snafu(display("failed to list Helm releases ({error})"))]
6767
ListReleases { error: String },
6868

6969
#[snafu(display("failed to install Helm release"))]
7070
InstallRelease { source: InstallReleaseError },
7171

72-
#[snafu(display("failed to uninstall Helm release: {error}"))]
72+
#[snafu(display("failed to uninstall Helm release ({error})"))]
7373
UninstallRelease { error: String },
7474
}
7575

@@ -93,7 +93,7 @@ pub enum InstallReleaseError {
9393
/// This error indicates that there was an Helm error. The error it self
9494
/// is not typed, as the error is a plain string coming directly from the
9595
/// FFI bindings.
96-
#[snafu(display("helm error: {error}"))]
96+
#[snafu(display("helm FFI library call failed ({error})"))]
9797
HelmWrapper { error: String },
9898
}
9999

rust/stackable-cockpit/src/platform/operator/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub enum SpecParseError {
4343
#[snafu(display("empty operator spec input"))]
4444
EmptyInput,
4545

46-
#[snafu(display("invalid operator name: '{name}'"))]
46+
#[snafu(display("invalid operator name {name:?}"))]
4747
InvalidName { name: String },
4848
}
4949

rust/stackable-cockpit/src/utils/k8s/client.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ pub enum Error {
5050
#[snafu(display("failed to deploy manifest because type of object {object:?} is not set"))]
5151
ObjectType { object: DynamicObject },
5252

53+
#[snafu(display("failed to deploy manifest because GVK {group}/{kind}@{version} cannot be resolved",
54+
group = gvk.group,
55+
version = gvk.version,
56+
kind = gvk.kind
57+
))]
58+
DiscoveryResolve { gvk: GroupVersionKind },
59+
5360
#[snafu(display("failed to convert byte string into UTF-8 string"))]
5461
ByteStringConvert { source: FromUtf8Error },
5562

rust/stackablectl/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Fixed
8+
9+
- Remove colons from error messages, because the snafu report removes all
10+
content after the colon which results in loss of detail ([#300]).
11+
12+
[#300]: https://github.com/stackabletech/stackable-cockpit/pull/300
13+
714
## [24.3.4] - 2024-05-28
815

916
### Fixed

rust/xtask/src/docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const DOCS_BASE_PATH: &str = "docs/modules/stackablectl/partials/commands";
1111

1212
#[derive(Debug, Snafu)]
1313
pub enum GenDocsError {
14-
#[snafu(display("No such subcommand: {name}"))]
14+
#[snafu(display("subcommand {name:?} not found"))]
1515
NoSuchSubcommand { name: String },
1616

1717
#[snafu(display("io error"))]

web/src/api/schema.d.ts

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)