Skip to content

Commit cdf5c36

Browse files
committed
Carry indivual fields in error message
1 parent 78bd455 commit cdf5c36

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

crates/stackable-operator/src/builder/pod/container.rs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,22 @@ pub enum Error {
2828

2929
#[snafu(display(
3030
"The volumeMount is clashing with an already existing volumeMount with the same mountPath but a different content. \
31-
The existing volumeMount is {existing_volume_mount:?}, the new one is {new_volume_mount:?}"
31+
The shared mountPath is {mount_path:?}, \
32+
the existing mount's volume name is {existing_volume_name:?}, \
33+
the existing mount's subPath is {existing_sub_path:?}, \
34+
the existing mount's SubPathExpr is {existing_sub_path_expr:?}, \
35+
the new mount's volume name is {new_volume_name:?}, \
36+
the new mount's subPath is {new_sub_path:?}, \
37+
the new mount's SubPathExpr is {new_sub_path_expr:?}"
3238
))]
33-
ClashingVolumeMountMountPath {
34-
existing_volume_mount: Box<VolumeMount>,
35-
new_volume_mount: Box<VolumeMount>,
39+
ClashingMountPath {
40+
mount_path: String,
41+
existing_volume_name: String,
42+
existing_sub_path: Option<String>,
43+
existing_sub_path_expr: Option<String>,
44+
new_volume_name: String,
45+
new_sub_path: Option<String>,
46+
new_sub_path_expr: Option<String>,
3647
},
3748
}
3849

@@ -219,9 +230,14 @@ impl ContainerBuilder {
219230
if let Some(existing_volume_mount) = self.volume_mounts.get(&volume_mount.mount_path) {
220231
ensure!(
221232
existing_volume_mount == &volume_mount,
222-
ClashingVolumeMountMountPathSnafu {
223-
existing_volume_mount: existing_volume_mount.clone(),
224-
new_volume_mount: volume_mount,
233+
ClashingMountPathSnafu {
234+
mount_path: volume_mount.mount_path,
235+
existing_volume_name: existing_volume_mount.name.clone(),
236+
existing_sub_path: existing_volume_mount.sub_path.clone(),
237+
existing_sub_path_expr: existing_volume_mount.sub_path_expr.clone(),
238+
new_volume_name: volume_mount.name,
239+
new_sub_path: volume_mount.sub_path,
240+
new_sub_path_expr: volume_mount.sub_path_expr,
225241
}
226242
);
227243
} else {

0 commit comments

Comments
 (0)