justinmclean opened a new issue, #9306:
URL: https://github.com/apache/gravitino/issues/9306

   ### What would you like to be improved?
   
   Improve exception handling to include unknown group.
   
   Here's a unit test to help.
   ```
     @Test
     void handleWithMissingGroupExitsWithUnknownGroupError() throws Exception {
       CommandLine mockCmdLine = Mockito.mock(CommandLine.class);
       CommandContext context = new CommandContext(mockCmdLine);
   
       RemoveRoleFromGroup command =
           Mockito.spy(new RemoveRoleFromGroup(context, "metalake1", "group1", 
"role1"));
   
       GravitinoClient mockClient = Mockito.mock(GravitinoClient.class);
       Mockito.doReturn(mockClient).when(command).buildClient("metalake1");
       Mockito.doThrow(new NoSuchGroupException("group missing"))
           .when(mockClient)
           .revokeRolesFromGroup(Collections.singletonList("role1"), "group1");
   
       RuntimeException ex = Assertions.assertThrows(RuntimeException.class, 
command::handle);
   
       Assertions.assertTrue(ex.getMessage().contains("Exit with code -1"));
       
Assertions.assertTrue(errContent.toString().contains(ErrorMessages.UNKNOWN_GROUP));
     }
   ```
   
   ### How should we improve?
   
   _No response_


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