Skip to content

Commit

Permalink
Merge pull request #522 from hwupathum/patch-400
Browse files Browse the repository at this point in the history
Return 404 response when changing a non-existing role
  • Loading branch information
hwupathum committed Jan 22, 2024
2 parents 0fcb440 + ff89a31 commit b01e383
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 b01e383

Please sign in to comment.