neils-dev commented on a change in pull request #2901:
URL: https://github.com/apache/ozone/pull/2901#discussion_r779165203
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerServiceGrpc.java
##########
@@ -126,20 +127,19 @@ public void submitRequest(OMRequest request,
omResponse =
UserGroupInformation.getCurrentUser().doAs(
(PrivilegedExceptionAction<OMResponse>) () -> {
- try {
return this.omTranslator.
submitRequest(NULL_RPC_CONTROLLER, request);
- } catch (Throwable se) {
- Throwable e = se.getCause();
- if (e == null) {
- throw new IOException(se);
- } else {
- throw e instanceof IOException ?
- (IOException) e : new IOException(se);
- }
- }
});
} catch (Throwable e) {
+ IOException ex = new IOException(e.getCause());
+ responseObserver.onError(Status
+ .INTERNAL
+ .withDescription(ex.getMessage())
+ .asRuntimeException());
+
+ // setting the omResponse, unused since we are generating
+ // standard model gRPC error through grpc Status and
Review comment:
Thanks @bharatviswa504 for your review and comments! Right, for the
expected exceptions for handling Service exceptions we handle with standard
gRPC error `onError`. For others, the error is returned through the OmResponse
(status not ok with exception in message). Yes, the lines setting the error
for the omResponse is no longer needed (legacy code). I'll cleanup removing
lines 140 - 145 (setting the omResponse error) and the method
`createErrorResponse` as well, as unneeded.
--
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]