jerryshao commented on code in PR #5144:
URL: https://github.com/apache/gravitino/pull/5144#discussion_r1806284069
##########
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:
I think it is better to handle `IllegalRoleException` in the core, not
convert to this exception in here.
--
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]