diff --git a/rad/views.py b/rad/views.py index 2ac1bd86..c5146ad1 100644 --- a/rad/views.py +++ b/rad/views.py @@ -686,7 +686,10 @@ def stats(request): # HTTP Error 400 def page_not_found(request, exception): - response = render(request, "404.html") + # Provide the exception message (reason) to the template so callers + # can show a user-friendly explanation when available. + context = {"reason": str(exception) if exception is not None else "Not found"} + response = render(request, "404.html", context=context) response.status_code = 404