Opened 9 years ago
Closed 9 years ago
#24877 closed New feature (fixed)
Exceptions in renderizable responses are not handled by Middleware's `process_exception()`
Reported by: | German M. Bravo | Owned by: | Sylvain Fankhauser |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If a response which has render()
method raises an exception, the exception is not handled by the middleware's process_exception()
method.
Probably there's a missing try/except in https://github.com/django/django/blob/master/django/core/handlers/base.py#L176, like the one in #L145.
Change History (7)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Component: | Uncategorized → HTTP handling |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → New feature |
Version: | 1.8 → master |
comment:3 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 9 years ago
Patch needs improvement: | unset |
---|
Note:
See TracTickets
for help on using tickets.
As timograham said in the IRC, the docs say
process_exception()
will be called if the view raises an exception, so it seems a bit ambiguous if that includes deferred template rendering or not.As the response object could be a response object of any type (just with a render method), it'd be a nice enhancement if it also checked for exceptions being thrown there to be handled by the middlewares.