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 German M. Bravo, 9 years ago

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.

comment:2 by Tim Graham, 9 years ago

Component: UncategorizedHTTP handling
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature
Version: 1.8master

comment:3 by Sylvain Fankhauser, 9 years ago

Owner: changed from nobody to Sylvain Fankhauser
Status: newassigned

comment:4 by Tim Graham, 9 years ago

Has patch: set

comment:5 by Tim Graham, 9 years ago

Patch needs improvement: set

Comments for improvement on the PR.

comment:6 by Tim Graham, 9 years ago

Patch needs improvement: unset

comment:7 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In f5d5867a:

Fixed #24877 -- Added middleware handling of response.render() errors.

Note: See TracTickets for help on using tickets.
Back to Top