Added NotFoundError to courses/ if _courses is empty

This commit is contained in:
Marcel Kapfer (mmk2410) 2016-06-14 22:04:04 +02:00
parent ca3c119adb
commit a302feb17d
1 changed files with 3 additions and 0 deletions

View File

@ -37,6 +37,9 @@ class TitamaApi {
@ApiMethod(path: 'courses')
List<Course> listCourses() {
if (_courses.isEmpty) {
throw new NotFoundError('Could not find any courses.');
}
return _courses;
}