Duong created HDDS-6903:
---------------------------
Summary: Correct mapping of exceptions to HTTP codes
Key: HDDS-6903
URL: https://issues.apache.org/jira/browse/HDDS-6903
Project: Apache Ozone
Issue Type: Improvement
Components: S3
Reporter: Duong
Today, all exceptions including user validations, permissions... are mapped to
HTTP 500 - Internal Server Errors.
This is due to the lack of an appropriate Jersey exception handler. Hence, all
exceptions, including OMException, is considered as unhandled and thus internal
server errors, e.g.
{code:java}
sh-4.2$ aws s3api --endpoint http://localhost:9878 list-objects --bucket
bucket_3An error occurred (500) when calling the ListObjects operation (reached
max retries: 4): Internal Server Error {code}
We need to implement an exception mapper to map exceptions to correct response
codes e.g
{code:java}
OMException.ResultCodes.INVALID_BUCKET_NAME,
OMException.ResultCodes.INVALID_VOLUME_NAME,... => 400
OMException.ResultCodes.PERMISSION_DENIED => 403
...{code}
The complete mapping can be built based on the Exception/ResultCode and
matching them with the [error codes from S3
API|https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList].
Proper error codes will bring the S3G API closer to the standard S3 API.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]