[ 
https://issues.apache.org/jira/browse/HDDS-6903?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Duong updated HDDS-6903:
------------------------
    Description: 
Today, user related exception handlings are inconsistent across endpoints

 

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_3
An 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. Technically, this can be a Jersey level exception handler to avoid 
repeating the same logic in every endpoint.
{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].

 

 

  was:
Today, exception handling are inconsistent 

 

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_3
An 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. Technically, this can be a Jersey level exception handler to avoid 
repeating the same logic in every endpoint.
{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].

 

 


> 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
>            Priority: Major
>
> Today, user related exception handlings are inconsistent across endpoints
>  
> 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_3
> An 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. Technically, this can be a Jersey level exception handler to 
> avoid repeating the same logic in every endpoint.
> {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].
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to