Added NotFoundError to courses/ if _courses is empty
This commit is contained in:
parent
ca3c119adb
commit
a302feb17d
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue