Skip to content

Commit 20aeb11

Browse files
authored
Add better error handling to Grades.get_grades (#89)
1 parent 6c0a061 commit 20aeb11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

edupage_api/grades.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __get_grade_data(self):
4545

4646
try:
4747
return self.__parse_grade_data(response)
48-
except json.JSONDecodeError:
48+
except (json.JSONDecodeError, IndexError):
4949
raise FailedToParseGradeDataError("Failed to parse JSON")
5050

5151
def __get_grade_data_for_term(self, term: Term, year: int):
@@ -54,7 +54,7 @@ def __get_grade_data_for_term(self, term: Term, year: int):
5454

5555
try:
5656
return self.__parse_grade_data(response)
57-
except json.JSONDecodeError:
57+
except (json.JSONDecodeError, IndexError):
5858
raise FailedToParseGradeDataError("Failed to parse JSON")
5959

6060
@ModuleHelper.logged_in

0 commit comments

Comments
 (0)