Skip to content

Commit 21452fe

Browse files
Gehockmarkkuriekkinen
authored andcommitted
Fix KeyError when displaying errors from a celery task
1 parent ce4e8f1 commit 21452fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

provider/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ def get_full_course_config(api_user_id, course_id, has_radar_config=True):
183183
exercises = response.get("exercises", [])
184184
except APIAuthException:
185185
exercises = []
186-
result["errors"].append("This user does not have correct credentials to use the API of %s" % repr(course))
186+
result.setdefault("errors", []).append("This user does not have correct credentials to use the API of %s" % repr(course))
187187

188188
if not exercises:
189-
result["errors"].append("No exercises found for %s" % repr(course))
189+
result.setdefault("errors", []).append("No exercises found for %s" % repr(course))
190190

191191
if has_radar_config:
192192
# Exercise API data is expected to contain Radar configurations

0 commit comments

Comments
 (0)