aboutsummaryrefslogtreecommitdiffhomepage
path: root/system
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-30 23:44:48 +0900
committerOphestra <cat@gensokyo.uk>2025-08-30 23:44:48 +0900
commit712cfc06d7e541c6e28b4b127a4760b4cfccffa8 (patch)
tree3dbd2bc0fc03ba5d108646b342392f5fdf841c90 /system
parentf5abce9df5727904a1daa246025a87c4bfe62553 (diff)
container: wrap container init start errors
This helps indicate the exact origin and nature of the error. This eliminates generic WrapErr from container. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system')
-rw-r--r--system/output.go8
-rw-r--r--system/output_test.go4
2 files changed, 7 insertions, 5 deletions
diff --git a/system/output.go b/system/output.go
index ec1802b6..f3a4bc5c 100644
--- a/system/output.go
+++ b/system/output.go
@@ -33,14 +33,16 @@ func (e *OpError) Error() string {
}
switch {
- case errors.As(e.Err, new(*os.PathError)), errors.As(e.Err, new(*net.OpError)):
+ case errors.As(e.Err, new(*os.PathError)),
+ errors.As(e.Err, new(*net.OpError)),
+ errors.As(e.Err, new(*container.StartError)):
return e.Err.Error()
default:
if !e.Revert {
- return "cannot apply " + e.Op + ": " + e.Err.Error()
+ return "apply " + e.Op + ": " + e.Err.Error()
} else {
- return "cannot revert " + e.Op + ": " + e.Err.Error()
+ return "revert " + e.Op + ": " + e.Err.Error()
}
}
}
diff --git a/system/output_test.go b/system/output_test.go
index 5ad219b7..ba760e84 100644
--- a/system/output_test.go
+++ b/system/output_test.go
@@ -26,11 +26,11 @@ func TestOpError(t *testing.T) {
ErrDBusConfig, syscall.ENOTRECOVERABLE},
{"apply", newOpError("tmpfile", syscall.EBADE, false),
- "cannot apply tmpfile: invalid exchange",
+ "apply tmpfile: invalid exchange",
syscall.EBADE, syscall.EBADF},
{"revert", newOpError("wayland", syscall.EBADF, true),
- "cannot revert wayland: bad file descriptor",
+ "revert wayland: bad file descriptor",
syscall.EBADF, syscall.EBADE},
{"path", newOpError("tmpfile", &os.PathError{Op: "stat", Path: "/run/dbus", Err: syscall.EISDIR}, false),