exceptions: store exception about failed exc email sending
This commit is contained in:
parent
241c6c738b
commit
5cfea23393
1 changed files with 5 additions and 3 deletions
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
import os
|
||||
import time
|
||||
import sys
|
||||
import datetime
|
||||
import msgpack
|
||||
import logging
|
||||
|
|
@ -115,7 +116,8 @@ def _store_exception(exc_id, exc_type_name, exc_traceback, prefix, send_email=No
|
|||
send_exc_email(request, exc_id, exc_type_name)
|
||||
except Exception:
|
||||
log.exception('Failed to send exception email')
|
||||
pass
|
||||
exc_info = sys.exc_info()
|
||||
store_exception(id(exc_info), exc_info, send_email=False)
|
||||
|
||||
|
||||
def send_exc_email(request, exc_id, exc_type_name):
|
||||
|
|
@ -160,7 +162,7 @@ def _prepare_exception(exc_info):
|
|||
return exc_type_name, tb
|
||||
|
||||
|
||||
def store_exception(exc_id, exc_info, prefix=global_prefix):
|
||||
def store_exception(exc_id, exc_info, prefix=global_prefix, send_email=None):
|
||||
"""
|
||||
Example usage::
|
||||
|
||||
|
|
@ -171,7 +173,7 @@ def store_exception(exc_id, exc_info, prefix=global_prefix):
|
|||
try:
|
||||
exc_type_name, exc_traceback = _prepare_exception(exc_info)
|
||||
_store_exception(exc_id=exc_id, exc_type_name=exc_type_name,
|
||||
exc_traceback=exc_traceback, prefix=prefix)
|
||||
exc_traceback=exc_traceback, prefix=prefix, send_email=send_email)
|
||||
return exc_id, exc_type_name
|
||||
except Exception:
|
||||
log.exception('Failed to store exception `%s` information', exc_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue