#2481: Exceptions thrown by request middleware are not caught
----------------------------+-----------------------------------------------
Reporter: Simon Willison | Owner: adrian
Type: defect | Status: new
Priority: low | Milestone:
Component: Core framework | Version:
Severity: minor | Keywords:
----------------------------+-----------------------------------------------
At the moment, an exception thrown by request middleware is not caught by
Django's exception handling middleware, and can result in an ugly Apache
default 500 error screen. This also means that you can't throw an Http404
exception in request middleware, which is annoying as an obvious use for
it is to apply additional URL filtering or blocking.
My particular use case is throwing a 404 for unknown subdomains while
using wildcard DNS. At the moment I'm having to use view middleware for
this instead to ensure the 404 gets caught.
Is there a reason that request middleware is executed outside the main
try/catch block, or could it be moved in there without breaking anything?
Here's
[http://code.djangoproject.com/browser/django/trunk/django/core/handlers/base.py?rev=3411#L57
the code in question].
--
Ticket URL: <http://code.djangoproject.com/ticket/2481>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---