From 833701165aad9d55adda23f48bb5a46cdbcff5b1 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Mon, 27 Jan 2020 21:05:17 +0900 Subject: [PATCH] ctr events: do not exit on an error Errors like `"type with url %s: not found"` are typical for non-builtin event types, and should not resultin exiting `ctr`. Signed-off-by: Akihiro Suda --- cmd/ctr/commands/events/events.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/ctr/commands/events/events.go b/cmd/ctr/commands/events/events.go index dae7a9f16..709b1a66f 100644 --- a/cmd/ctr/commands/events/events.go +++ b/cmd/ctr/commands/events/events.go @@ -22,6 +22,7 @@ import ( "github.com/containerd/containerd/cmd/ctr/commands" "github.com/containerd/containerd/events" + "github.com/containerd/containerd/log" "github.com/containerd/typeurl" "github.com/urfave/cli" @@ -54,11 +55,13 @@ var Command = cli.Command{ if e.Event != nil { v, err := typeurl.UnmarshalAny(e.Event) if err != nil { - return err + log.G(ctx).WithError(err).Warn("cannot unmarshal an event from Any") + continue } out, err = json.Marshal(v) if err != nil { - return err + log.G(ctx).WithError(err).Warn("cannot marshal Any into JSON") + continue } } if _, err := fmt.Println(