Skip to content

Commit

Permalink
hotfix: add try-catch when CreateUsers (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuraf committed Apr 23, 2024
1 parent df17812 commit 75f2aa1
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,18 @@ public void sendCompletedEmail(Onboarding onboarding) {
@Override
public void persistUsers(Onboarding onboarding) {
if(isUserMSActive) {
List<User> users = onboarding.getUsers();
users.forEach(user -> {

for(User user: onboarding.getUsers()) {
AddUserRoleDto userRoleDto = userMapper.toUserRole(onboarding);
userRoleDto.setUserMailUuid(user.getUserMailUuid());
userRoleDto.setProduct(productMapper.toProduct(onboarding, user));
userRoleDto.getProduct().setTokenId(onboarding.getId());
Response response = userApi.usersUserIdPost(user.getId(), userRoleDto);
if(!SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
throw new RuntimeException("Impossible to create or update role for user with ID: " + user.getId());
try (Response response = userApi.usersUserIdPost(user.getId(), userRoleDto)) {
if (!SUCCESSFUL.equals(response.getStatusInfo().getFamily())) {
throw new RuntimeException("Impossible to create or update role for user with ID: " + user.getId());
}
}
});
}
}
}

Expand Down

0 comments on commit 75f2aa1

Please sign in to comment.