[ 
https://issues.apache.org/jira/browse/HDDS-560?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16631778#comment-16631778
 ] 

Elek, Marton commented on HDDS-560:
-----------------------------------

Thanks [~bharatviswa]. Based on the code it looks good to me (didn't test it 
yet). Two comments:

1. I think the the OSException could be a RuntimeException. I know that it's a 
personal belief (so I don't insist to use it), but from my point of view 
declaring 'throws Exception' everywhere is not safer than using 
RuntimeException. But you can ignore this point ;-)

2. What is the suggested pattern for the other exceptions (getBucket, catch, 
else). Currently we re-throw it. Will we have a generic exception handler which 
transforms all unexpected exceptions to OS3Exception? I think it would be more 
safe. (It's more like a generic question, not for this jira)

3.  If we will have a generic exception handler, it's more simple to LOG the 
error there. We don't need to add the LOG.error to the getBucket as with this 
approach we will print out the error everywhere (but not in a consistent way as 
some rest endpoint may not have this logging). Again, this is for the long 
term. In this patch, it's better to have it, as there is no other logging AFAIK.

> Create Generic exception class to be used by S3 rest services
> -------------------------------------------------------------
>
>                 Key: HDDS-560
>                 URL: https://issues.apache.org/jira/browse/HDDS-560
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: Bharat Viswanadham
>            Assignee: Bharat Viswanadham
>            Priority: Major
>         Attachments: HDDS-560.00.patch
>
>
> Exception class should have the following fields, and structure should be as 
> below:
>  
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <Error>
> <Code>NoSuchKey</Code>
> <Message>The resource you requested does not exist</Message> 
> <Resource>/mybucket/myfoto.jpg</Resource>
> <RequestId>4442587FB7D0A2F9</RequestId>
> </Error>
> {code}
>  
>  
> https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to