openedx / openedx/openedx-platform

Don't allow error pages to raise errors

Open
#35,216 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.2k
Forks
4.4k
Avg merge
6d 18h
Merged PRs (30d)
42

Description

The generic error views for 403, 404, and 500 can themselves raise exceptions, resulting in users not having intelligible error pages and making it harder for service operators to understand what is happening.

See https://github.com/openedx/edx-platform/issues/35151 for some past fallout of these problems. Note in particular that bad translations can cause error pages to raise exceptions at any time.

Acceptance criteria:

  • Each of the static template views in lms/djangoapps/static_template_view/views.py that manages some kind of error condition must have a try/except and a fallback to a hardcoded string. No DB calls, translations, etc. in the hardcoded value.
  • In each place where an error template has logic that makes DB calls, relies on user/session information, translations, etc., there is a try/except that can substitute in an acceptable fallback value.
  • Optionally: Mark the current span as having an error, using record_exception from edx-django-utils

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lms/djangoapps/static_template_view/views.py and review each static template view handling 403, 404, or 500 conditions. Trace error-template logic involving database calls, user or session data, and translations, including get_enterprise_learner_portal. Done means every such path has an acceptable hardcoded or substituted fallback, with the optional span error recording considered separately.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.