adoroszlai commented on code in PR #2424:
URL: https://github.com/apache/ozone/pull/2424#discussion_r1363134685


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketCreateRequest.java:
##########
@@ -245,8 +246,10 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
           CreateBucketResponse.newBuilder().build());
       omClientResponse = new OMBucketCreateResponse(omResponse.build(),
           omBucketInfo, omVolumeArgs.copyObject());
-    } catch (IOException ex) {
-      exception = ex;
+    } catch (IOException | InvalidPathException ex) {
+      exception = ex instanceof IOException ? (IOException) ex :
+          new OMException(ex.getMessage(),
+              OMException.ResultCodes.INVALID_PATH);
       omClientResponse = new OMBucketCreateResponse(
           createErrorOMResponse(omResponse, exception));

Review Comment:
   Can this exception translation logic be moved into `createErrorOMResponse`?  
It would help avoid code duplication, and I think it's also better if the code 
using `exception` (logging, etc.) gets the original one.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to