summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2024-09-27 14:55:15 +0200
committerPaul Holzinger <pholzing@redhat.com>2024-09-27 15:15:23 +0200
commit1950555b2646fc5a49d5ce66b4b375b386ec063b (patch)
treeed9fcf9abdd21c9e7218dca769c913b4fa11174f
parent5c3019e0288830e77ac19ad330ab77a2277be4ae (diff)
podman mount: some better error wrapping
As shown in #23671 these functions can return the raw error without any useful context to the user which makes it hard to understand where things went wrong. Simply add some context to some error paths here. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r--libpod/runtime_ctr.go4
-rw-r--r--pkg/domain/infra/abi/containers.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 3551613a1..87d848478 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -1412,13 +1412,13 @@ func (r *Runtime) IsStorageContainerMounted(id string) (bool, string, error) {
mountCnt, err := r.storageService.MountedContainerImage(id)
if err != nil {
- return false, "", err
+ return false, "", fmt.Errorf("get mount count of container: %w", err)
}
mounted := mountCnt > 0
if mounted {
path, err = r.storageService.GetMountpoint(id)
if err != nil {
- return false, "", err
+ return false, "", fmt.Errorf("get container mount point: %w", err)
}
}
return mounted, path, nil
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index d2f99a26f..b6a7baa04 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -1421,7 +1421,7 @@ func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIDs []strin
if errors.Is(err, types.ErrContainerUnknown) || errors.Is(err, types.ErrLayerUnknown) || errors.Is(err, define.ErrCtrExists) {
continue
}
- return nil, err
+ return nil, fmt.Errorf("check if storage container is mounted: %w", err)
}
var name string
@@ -1449,7 +1449,7 @@ func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIDs []strin
errors.Is(err, define.ErrCtrRemoved) {
continue
}
- return nil, err
+ return nil, fmt.Errorf("check if container is mounted: %w", err)
}
if mounted {