Ticket #13850: uncaught-exception-email.patch
File uncaught-exception-email.patch, 1.6 KB (added by , 14 years ago) |
---|
-
base.py
144 144 # isolation of request.urlconf 145 145 urlresolvers.set_urlconf(None) 146 146 147 def make_uncaught_exception_email(self, request, exc_info): 148 subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path) 149 try: 150 request_repr = repr(request) 151 except: 152 request_repr = "Request repr() unavailable" 153 message = "%s\n\n%s" % (self._get_traceback(exc_info), request_repr) 154 return subject, message 155 147 156 def handle_uncaught_exception(self, request, resolver, exc_info): 148 157 """ 149 158 Processing for any otherwise uncaught exceptions (those that will … … 165 174 return debug.technical_500_response(request, *exc_info) 166 175 167 176 # When DEBUG is False, send an error message to the admins. 168 subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path) 169 try: 170 request_repr = repr(request) 171 except: 172 request_repr = "Request repr() unavailable" 173 message = "%s\n\n%s" % (self._get_traceback(exc_info), request_repr) 177 subject, message = self.make_uncaught_exception_email(request, exc_info) 174 178 mail_admins(subject, message, fail_silently=True) 175 179 # If Http500 handler is not installed, re-raise last exception 176 180 if resolver.urlconf_module is None: