зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1255986 - [moztest] Safe-guard structured logging for exceptions from bad handlers. r=jgraham
Any exception which gets thrown by a log handler while test results are getting generated, should not cause test harnesses to stop immediately. To achive that the exception details are written to stderr and not propagated up the stack. MozReview-Commit-ID: ChyYxApYSGx --HG-- extra : rebase_source : 9fc3fe597061bedb1df2f5b8de1daa4bd127ea1e
This commit is contained in:
Родитель
0b57c68c53
Коммит
3caa86c072
|
@ -207,7 +207,13 @@ class StructuredLogger(object):
|
|||
return
|
||||
|
||||
for handler in self.handlers:
|
||||
handler(data)
|
||||
try:
|
||||
handler(data)
|
||||
except Exception:
|
||||
# Write the exception details directly to stderr because
|
||||
# log() would call this method again which is currently locked.
|
||||
print >> sys.__stderr__, '%s: Failure calling log handler:' % __name__
|
||||
print >> sys.__stderr__, traceback.format_exc()
|
||||
|
||||
def _make_log_data(self, action, data):
|
||||
all_data = {"action": action,
|
||||
|
|
Загрузка…
Ссылка в новой задаче