From 69b2aacf5a8af20e82aac6f3d8a13d90533b485e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 11 Mar 2020 14:11:04 -0700 Subject: [PATCH] fix return proper error for OperationTimedout (#9117) OperationTimedout error occurs when locking timesout, trying to acquire a lock. This error should be returned appropriately to the client with http status "408" (request timedout) This translation was broken, fix it. --- cmd/api-errors.go | 4 +++- cmd/typed-errors.go | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/api-errors.go b/cmd/api-errors.go index dbc856d33..998b38488 100644 --- a/cmd/api-errors.go +++ b/cmd/api-errors.go @@ -1641,7 +1641,7 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) { apiErr = ErrKMSNotConfigured case crypto.ErrKMSAuthLogin: apiErr = ErrKMSAuthFailure - case errOperationTimedOut, context.Canceled, context.DeadlineExceeded: + case context.Canceled, context.DeadlineExceeded: apiErr = ErrOperationTimedOut case errDiskNotFound: apiErr = ErrSlowDown @@ -1769,6 +1769,8 @@ func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) { apiErr = ErrOverlappingFilterNotification case *event.ErrUnsupportedConfiguration: apiErr = ErrUnsupportedNotification + case OperationTimedOut: + apiErr = ErrOperationTimedOut case BackendDown: apiErr = ErrBackendDown case ObjectNameTooLong: diff --git a/cmd/typed-errors.go b/cmd/typed-errors.go index f16706edb..254a4641b 100644 --- a/cmd/typed-errors.go +++ b/cmd/typed-errors.go @@ -50,9 +50,6 @@ var errRPCAPIVersionUnsupported = errors.New("Unsupported rpc API version") // errServerTimeMismatch - server times are too far apart. var errServerTimeMismatch = errors.New("Server times are too far apart") -// errOperationTimedOut -var errOperationTimedOut = errors.New("Operation timed out") - // errInvalidBucketName - bucket name is reserved for MinIO, usually // returned for 'minio', '.minio.sys', buckets with capital letters. var errInvalidBucketName = errors.New("The specified bucket is not valid")