From 02e77bcdc1e48fb4089dab02d6b67955d48df4ad Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Fri, 1 Oct 2021 17:45:51 +0000 Subject: [PATCH] task service: return known error type Found this error in a docker daemon log classified as an "uknown" error. Since we know what this is return the correct error type so it can be handled. Signed-off-by: Brian Goff --- services/tasks/local.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/tasks/local.go b/services/tasks/local.go index 773325b15..d92b17c1d 100644 --- a/services/tasks/local.go +++ b/services/tasks/local.go @@ -210,7 +210,7 @@ func (l *local) Create(ctx context.Context, r *api.CreateTaskRequest, _ ...grpc. return nil, errdefs.ToGRPC(err) } if err == nil { - return nil, errdefs.ToGRPC(fmt.Errorf("task %s already exists", r.ContainerID)) + return nil, errdefs.ToGRPC(fmt.Errorf("task %s: %w", r.ContainerID, errdefs.ErrAlreadyExists)) } c, err := rtime.Create(ctx, r.ContainerID, opts) if err != nil {