jerqi commented on code in PR #5144:
URL: https://github.com/apache/gravitino/pull/5144#discussion_r1806290489


##########
server/src/main/java/org/apache/gravitino/server/web/rest/PermissionOperations.java:
##########
@@ -87,12 +89,17 @@ public Response grantRolesToUser(
                       TreeLockUtils.doWithTreeLock(
                           
NameIdentifier.of(AuthorizationUtils.ofRoleNamespace(metalake).levels()),
                           LockType.READ,
-                          () ->
-                              Utils.ok(
+                          () -> {
+                            try {
+                              return Utils.ok(
                                   new UserResponse(
                                       DTOConverters.toDTO(
                                           
accessControlManager.grantRolesToUser(
-                                              metalake, 
request.getRoleNames(), user)))))));
+                                              metalake, 
request.getRoleNames(), user))));
+                            } catch (NoSuchRoleException nsr) {

Review Comment:
   OK , just in my view, I usually throw `IllegalxxxException` in the other 
`Operation` class.  It's ok to throw in the core module.



-- 
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]

Reply via email to