1

Exception rework: clearer message + origin

Co-authored-by: [Mahgs] <maxoerter@gmx.de>
Co-authored-by: Christoph <tobi@urpost.de>
This commit is contained in:
Christoph
2020-03-18 18:49:40 +01:00
parent 2d8472bd4a
commit b1460abe48
20 changed files with 76 additions and 111 deletions

View File

@ -15,7 +15,7 @@ import mops.gruppen2.domain.Role;
@NoArgsConstructor
public class UpdateRoleEvent extends Event {
Role newRole;
private Role newRole;
public UpdateRoleEvent(Long group_id, String user_id, Role newRole) {
super(group_id, user_id);
@ -24,10 +24,11 @@ public class UpdateRoleEvent extends Event {
@Override
public void applyEvent(Group group) throws UserNotFoundException {
if (!group.getRoles().containsKey(user_id)) {
throw new UserNotFoundException();
if (group.getRoles().containsKey(user_id)) {
group.getRoles().put(this.user_id, this.newRole);
}
group.getRoles().put(this.user_id, this.newRole);
throw new UserNotFoundException(this.getClass().toString());
}
}