Make TECHNICAL_500 more resilient (against large variables and non-utf-8)
|Reported by:||Walter Doekes||Owned by:||nobody|
|Cc:||Walter Doekes||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I recently had errors that didn't provide a nice TECHNICAL_500_TEMPLATE mail.
The cause turned out to be two things:
(1) large variables caused a mail so large that the MXs refused to deliver them
(2) non-utf8 representations of objects caused errors while handling the error
The attached fix fixed it.
This was done against Django 1.4. Apologies in advance if this is fixed somewhere already. I couldn't find a relevant bug report.
Triggering (1) should be a matter of generating an error up the stack with a huge variable. Triggering (2) can be done like this:
urlpatterns = ( # Error test (r'500$', (lambda r: Crap())), # ExplodeInYourFaceError ) class Crap(Exception): def __init__(self): raise self def __repr__(self): return 'X\xe9X'
Change History (5)
comment:1 Changed 3 years ago by
|Patch needs improvement:||unset|
|Triage Stage:||Unreviewed → Accepted|