##// END OF EJS Templates
exceptions: store exception about failed exc email sending
super-admin -
r4811:201c0563 default
parent child Browse files
Show More
@@ -20,6 +20,7 b''
20
20
21 import os
21 import os
22 import time
22 import time
23 import sys
23 import datetime
24 import datetime
24 import msgpack
25 import msgpack
25 import logging
26 import logging
@@ -115,7 +116,8 b' def _store_exception(exc_id, exc_type_na'
115 send_exc_email(request, exc_id, exc_type_name)
116 send_exc_email(request, exc_id, exc_type_name)
116 except Exception:
117 except Exception:
117 log.exception('Failed to send exception email')
118 log.exception('Failed to send exception email')
118 pass
119 exc_info = sys.exc_info()
120 store_exception(id(exc_info), exc_info, send_email=False)
119
121
120
122
121 def send_exc_email(request, exc_id, exc_type_name):
123 def send_exc_email(request, exc_id, exc_type_name):
@@ -160,7 +162,7 b' def _prepare_exception(exc_info):'
160 return exc_type_name, tb
162 return exc_type_name, tb
161
163
162
164
163 def store_exception(exc_id, exc_info, prefix=global_prefix):
165 def store_exception(exc_id, exc_info, prefix=global_prefix, send_email=None):
164 """
166 """
165 Example usage::
167 Example usage::
166
168
@@ -171,7 +173,7 b' def store_exception(exc_id, exc_info, pr'
171 try:
173 try:
172 exc_type_name, exc_traceback = _prepare_exception(exc_info)
174 exc_type_name, exc_traceback = _prepare_exception(exc_info)
173 _store_exception(exc_id=exc_id, exc_type_name=exc_type_name,
175 _store_exception(exc_id=exc_id, exc_type_name=exc_type_name,
174 exc_traceback=exc_traceback, prefix=prefix)
176 exc_traceback=exc_traceback, prefix=prefix, send_email=send_email)
175 return exc_id, exc_type_name
177 return exc_id, exc_type_name
176 except Exception:
178 except Exception:
177 log.exception('Failed to store exception `%s` information', exc_id)
179 log.exception('Failed to store exception `%s` information', exc_id)
General Comments 0
You need to be logged in to leave comments. Login now