Skip to content

Commit

Permalink
Fix KeyError when displaying errors from a celery task
Browse files Browse the repository at this point in the history
  • Loading branch information
Gehock authored and markkuriekkinen committed Apr 29, 2021
1 parent ce4e8f1 commit 21452fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions provider/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ def get_full_course_config(api_user_id, course_id, has_radar_config=True):
exercises = response.get("exercises", [])
except APIAuthException:
exercises = []
result["errors"].append("This user does not have correct credentials to use the API of %s" % repr(course))
result.setdefault("errors", []).append("This user does not have correct credentials to use the API of %s" % repr(course))

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

if has_radar_config:
# Exercise API data is expected to contain Radar configurations
Expand Down

0 comments on commit 21452fe

Please sign in to comment.