fix(objectnode): fix incorrect statusCode when creating volume in objectnode. #1000146602

Signed-off-by: zhumingze <zhumingze@oppo.com>
This commit is contained in:
zhumingze 2025-05-29 11:06:37 +08:00 committed by zhumingze1108
parent 15b24c6d0e
commit b74b3fa74e
2 changed files with 6 additions and 0 deletions

View File

@ -123,6 +123,11 @@ func (o *ObjectNode) createBucketHandler(w http.ResponseWriter, r *http.Request)
if err = o.mc.AdminAPI().CreateDefaultVolume(bucket, userInfo.UserID); err != nil {
log.LogErrorf("createBucketHandler: create bucket fail: requestID(%v) volume(%v) accessKey(%v) err(%v)",
GetRequestID(r), bucket, param.AccessKey(), err)
if err == proto.ErrDuplicateVol {
err = DuplicateVol
} else {
err = InternalErrorCode(err)
}
return
}

View File

@ -90,6 +90,7 @@ var (
ObjectLockConfigurationNotFound = &ErrorCode{"ObjectLockConfigurationNotFoundError", "Object Lock configuration does not exist for this bucket", http.StatusNotFound}
TooManyRequests = &ErrorCode{"TooManyRequests", "too many requests, please retry later", http.StatusTooManyRequests}
MalformedPOSTRequest = &ErrorCode{ErrorCode: "MalformedPOSTRequest", ErrorMessage: "The body of your POST request is not well-formed multipart/form-data.", StatusCode: http.StatusBadRequest}
DuplicateVol = &ErrorCode{ErrorCode: "DuplicateVol", ErrorMessage: "Duplicate Vol", StatusCode: http.StatusBadRequest}
)
type ErrorCode struct {