Skip to content

Commit

Permalink
Use 404 response when invalid roleID id given
Browse files Browse the repository at this point in the history
  • Loading branch information
hwupathum committed Jan 22, 2024
1 parent 22f2388 commit ff89a31
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ private void doUpdateRoleName(RoleV2 oldRole, RoleV2 newRole)
}
}

private String getCurrentRoleName(String roleId, String tenantDomain) throws CharonException, BadRequestException {
private String getCurrentRoleName(String roleId, String tenantDomain) throws CharonException, NotFoundException {

String currentRoleName;
try {
Expand All @@ -724,7 +724,7 @@ private String getCurrentRoleName(String roleId, String tenantDomain) throws Cha
}
} catch (IdentityRoleManagementException e) {
if ((ROLE_NOT_FOUND.getCode()).equals(e.getErrorCode())) {
throw new BadRequestException(e.getMessage());
throw new NotFoundException(e.getMessage());
}
throw new CharonException(String.format("Error occurred while getting the role name by " +
"the role id: %s", roleId), e);
Expand Down

0 comments on commit ff89a31

Please sign in to comment.