OLD | NEW |
1 # coding=utf-8 | 1 # coding=utf-8 |
2 # Copyright 2014 The Swarming Authors. All rights reserved. | 2 # Copyright 2014 The LUCI Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 that | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
4 # can be found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Declares a single function to report errors to a server. | 6 """Declares a single function to report errors to a server. |
7 | 7 |
8 By running the script, you accept that errors will be reported to the server you | 8 By running the script, you accept that errors will be reported to the server you |
9 connect to. | 9 connect to. |
10 """ | 10 """ |
11 | 11 |
12 import atexit | 12 import atexit |
13 import getpass | 13 import getpass |
14 import os | 14 import os |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 exc_info = sys.exc_info() | 261 exc_info = sys.exc_info() |
262 if _SERVER: | 262 if _SERVER: |
263 _report_exception( | 263 _report_exception( |
264 error, exc_info[1], ''.join(traceback.format_tb(exc_info[2]))) | 264 error, exc_info[1], ''.join(traceback.format_tb(exc_info[2]))) |
265 return | 265 return |
266 | 266 |
267 if error: | 267 if error: |
268 sys.stderr.write(error + '\n') | 268 sys.stderr.write(error + '\n') |
269 if exc_info[1]: | 269 if exc_info[1]: |
270 sys.stderr.write(_format_exception(exc_info[1]) + '\n') | 270 sys.stderr.write(_format_exception(exc_info[1]) + '\n') |
OLD | NEW |