handle exception InvalidPart (#6649)

This commit is contained in:
Wenjie 2018-10-18 00:20:58 +08:00 committed by Nitish Tiwari
parent 26b4b466df
commit 088c595e01
2 changed files with 6 additions and 0 deletions

View File

@ -294,6 +294,8 @@ func ErrorRespToObjectError(err error, params ...string) error {
err = BucketPolicyNotFound{} err = BucketPolicyNotFound{}
case "InvalidBucketName": case "InvalidBucketName":
err = BucketNameInvalid{Bucket: bucket} err = BucketNameInvalid{Bucket: bucket}
case "InvalidPart":
err = InvalidPart{}
case "NoSuchBucket": case "NoSuchBucket":
err = BucketNotFound{Bucket: bucket} err = BucketNotFound{Bucket: bucket}
case "NoSuchKey": case "NoSuchKey":

View File

@ -50,6 +50,10 @@ func TestS3ToObjectError(t *testing.T) {
inputErr: errResponse("InvalidBucketName"), inputErr: errResponse("InvalidBucketName"),
expectedErr: minio.BucketNameInvalid{}, expectedErr: minio.BucketNameInvalid{},
}, },
{
inputErr: errResponse("InvalidPart"),
expectedErr: minio.InvalidPart{},
},
{ {
inputErr: errResponse("NoSuchBucketPolicy"), inputErr: errResponse("NoSuchBucketPolicy"),
expectedErr: minio.BucketPolicyNotFound{}, expectedErr: minio.BucketPolicyNotFound{},