Skip to content

Commit

Permalink
handle bad request
Browse files Browse the repository at this point in the history
  • Loading branch information
AnuradhaSK committed Oct 15, 2023
1 parent 79ec3e7 commit 8376f51
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@

import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_ORGANIZATION_NOT_FOUND_FOR_TENANT;
import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.Error.INVALID_PERMISSION;
import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.Error.OPERATION_FORBIDDEN;
import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.Error.ROLE_NOT_FOUND;
import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.Error.INVALID_AUDIENCE;
Expand Down Expand Up @@ -156,7 +157,8 @@ public RoleV2 createRole(RoleV2 role)
throw new ConflictException(e.getMessage());
} else if (StringUtils.equals(INVALID_REQUEST.getCode(), e.getErrorCode())) {
throw new BadRequestException(e.getMessage());
} else if (INVALID_AUDIENCE.getCode().equals(e.getErrorCode())) {
} else if (INVALID_AUDIENCE.getCode().equals(e.getErrorCode()) ||
INVALID_PERMISSION.getCode().equals(e.getErrorCode())) {
throw new BadRequestException(e.getMessage(), ResponseCodeConstants.INVALID_VALUE);
}
throw new CharonException(
Expand Down

0 comments on commit 8376f51

Please sign in to comment.