1

add error handling (frontend) + exception changes

Co-authored-by: Christoph <tobi@urpost.de>
Co-authored-by: Mahgs <maxoerter@gmx.de>
This commit is contained in:
Christoph
2020-03-18 16:26:11 +01:00
parent 0ade9319fb
commit df7803f83d
20 changed files with 140 additions and 86 deletions

View File

@ -1,6 +1,7 @@
package mops.gruppen2.service;
import mops.gruppen2.domain.Exceptions.EventException;
import mops.gruppen2.domain.Exceptions.GroupNotFoundException;
import mops.gruppen2.domain.Group;
import mops.gruppen2.domain.User;
import mops.gruppen2.domain.event.Event;
@ -39,7 +40,12 @@ public class UserService {
public Group getGroupById(Long group_id) throws EventException {
List<Long> group_ids = new ArrayList<>();
group_ids.add(group_id);
List<Event> events = groupService.getGroupEvents(group_ids);
return groupService.projectEventList(events).get(0);
try {
List<Event> events = groupService.getGroupEvents(group_ids);
return groupService.projectEventList(events).get(0);
} catch (IndexOutOfBoundsException e) {
throw new GroupNotFoundException("Gruppe nicht gefunden");
}
}
}