Merge pull request #6079 from cpuguy83/correct_task_error

task service: return known error type
This commit is contained in:
Maksym Pavlenko
2021-10-01 15:26:49 -07:00
committed by GitHub

View File

@@ -209,7 +209,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 {