Return BucketAlreadyExists when bucket exists with another user

master
Remco Verhoef 8 years ago committed by Harshavardhana
parent 0a8cf1a6b0
commit 2d814e340f
  1. 3
      cmd/api-errors.go
  2. 5
      cmd/gateway-gcs-layer.go
  3. 7
      cmd/object-api-errors.go

@ -115,6 +115,7 @@ const (
ErrBucketAlreadyOwnedByYou ErrBucketAlreadyOwnedByYou
ErrInvalidDuration ErrInvalidDuration
ErrNotSupported ErrNotSupported
ErrBucketAlreadyExists
// Add new error codes here. // Add new error codes here.
// Bucket notification related errors. // Bucket notification related errors.
@ -679,6 +680,8 @@ func toAPIErrorCode(err error) (apiErr APIErrorCode) {
apiErr = ErrBucketAlreadyOwnedByYou apiErr = ErrBucketAlreadyOwnedByYou
case BucketNotEmpty: case BucketNotEmpty:
apiErr = ErrBucketNotEmpty apiErr = ErrBucketNotEmpty
case BucketAlreadyExists:
apiErr = ErrBucketAlreadyExists
case BucketExists: case BucketExists:
apiErr = ErrBucketAlreadyOwnedByYou apiErr = ErrBucketAlreadyOwnedByYou
case ObjectNotFound: case ObjectNotFound:

@ -131,7 +131,10 @@ func gcsToObjectError(err error, params ...string) error {
err = BucketAlreadyOwnedByYou{ err = BucketAlreadyOwnedByYou{
Bucket: bucket, Bucket: bucket,
} }
} else if message == "Sorry, that name is not available. Please try a different one." {
err = BucketAlreadyExists{
Bucket: bucket,
}
} else { } else {
err = BucketNotEmpty{ err = BucketNotEmpty{
Bucket: bucket, Bucket: bucket,

@ -144,6 +144,13 @@ func (e BucketNotFound) Error() string {
return "Bucket not found: " + e.Bucket return "Bucket not found: " + e.Bucket
} }
// BucketAlreadyExists the requested bucket name is not available.
type BucketAlreadyExists GenericError
func (e BucketAlreadyExists) Error() string {
return "The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again."
}
// BucketAlreadyOwnedByYou already owned by you. // BucketAlreadyOwnedByYou already owned by you.
type BucketAlreadyOwnedByYou GenericError type BucketAlreadyOwnedByYou GenericError

Loading…
Cancel
Save