Ticket #7471: patch-7471-no-tests.diff

File patch-7471-no-tests.diff, 1.6 KB (added by leahculver, 7 years ago)

return handle_uncaught_exception for errors with the 404 handler

  • django/core/handlers/base.py

     
    107107                from django.views import debug
    108108                return debug.technical_404_response(request, e)
    109109            else:
    110                 callback, param_dict = resolver.resolve404()
    111                 return callback(request, **param_dict)
     110                try:
     111                    callback, param_dict = resolver.resolve404()
     112                    return callback(request, **param_dict)
     113                except:
     114                    return self.handle_uncaught_exception(request, resolver, sys.exc_info())
    112115        except exceptions.PermissionDenied:
    113116            return http.HttpResponseForbidden('<h1>Permission denied</h1>')
    114117        except SystemExit:
     
    118121            # Get the exception info now, in case another exception is thrown later.
    119122            exc_info = sys.exc_info()
    120123            receivers = dispatcher.send(signal=signals.got_request_exception, request=request)
    121 
    122             if settings.DEBUG_PROPAGATE_EXCEPTIONS:
    123                 raise
    124124            return self.handle_uncaught_exception(request, resolver, exc_info)
    125125
    126126    def handle_uncaught_exception(self, request, resolver, exc_info):
     
    135135        """
    136136        from django.conf import settings
    137137        from django.core.mail import mail_admins
     138       
     139        if settings.DEBUG_PROPAGATE_EXCEPTIONS:
     140            raise
    138141
    139142        if settings.DEBUG:
    140143            from django.views import debug
Back to Top