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
commit 64291df71b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,7 +209,7 @@ func (l *local) Create(ctx context.Context, r *api.CreateTaskRequest, _ ...grpc.
return nil, errdefs.ToGRPC(err) return nil, errdefs.ToGRPC(err)
} }
if err == nil { 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) c, err := rtime.Create(ctx, r.ContainerID, opts)
if err != nil { if err != nil {