Skip to content

Commit

Permalink
Noobaa/Quota: Provide correct error message
Browse files Browse the repository at this point in the history
When we exceed the object quota for a bucket,
we should provide an error message which can
convey the clear problem.

https://issues.redhat.com/browse/DFBUGS-242

Signed-off-by: Ashish Pandey <[email protected]>
  • Loading branch information
aspandey committed Jan 9, 2025
1 parent 038ce84 commit 9ba2dcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/endpoint/s3/s3_errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ S3Error.InvalidBucketState = Object.freeze({
message: 'The request is not valid with the current state of the bucket.',
http_code: 409,
});
S3Error.ObjectQuotaExceeded = Object.freeze({
code: 'ObjectQuotaExceeded',
message: 'Object quota exceeded for the bucket.',
http_code: 409,
});
S3Error.InvalidDigest = Object.freeze({
code: 'InvalidDigest',
message: 'The Content-MD5 you specified is not valid.',
Expand Down Expand Up @@ -613,6 +618,7 @@ S3Error.RPC_ERRORS_TO_S3 = Object.freeze({
INVALID_PORT_ORDER: S3Error.InvalidPartOrder,
INVALID_BUCKET_STATE: S3Error.InvalidBucketState,
NOT_ENOUGH_SPACE: S3Error.InvalidBucketState,
OBJECT_QUOTA_EXCEEDED: S3Error.ObjectQuotaExceeded,
MALFORMED_POLICY: S3Error.MalformedPolicy,
NO_SUCH_OBJECT_LOCK_CONFIGURATION: S3Error.NoSuchObjectLockConfiguration,
OBJECT_LOCK_CONFIGURATION_NOT_FOUND_ERROR: S3Error.ObjectLockConfigurationNotFoundError,
Expand Down
2 changes: 1 addition & 1 deletion src/server/object_services/object_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@ function check_quota(bucket) {
if (major_messages.length > 0) {
const message = major_messages.join();
dbg.error(message);
throw new RpcError('INVALID_BUCKET_STATE', message);
throw new RpcError('OBJECT_QUOTA_EXCEEDED', message);
}
}

Expand Down

0 comments on commit 9ba2dcf

Please sign in to comment.