| OLD | NEW |
| 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Breakpad for Python. | 5 """Breakpad for Python. |
| 6 | 6 |
| 7 Sends a notification when a process stops on an exception.""" | 7 Sends a notification when a process stops on an exception.""" |
| 8 | 8 |
| 9 import atexit | 9 import atexit |
| 10 import getpass | 10 import getpass |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 'stack': stack, | 22 'stack': stack, |
| 23 'user': getpass.getuser(), | 23 'user': getpass.getuser(), |
| 24 } | 24 } |
| 25 request = urllib.urlopen(url, urllib.urlencode(params)) | 25 request = urllib.urlopen(url, urllib.urlencode(params)) |
| 26 print request.read() | 26 print request.read() |
| 27 request.close() | 27 request.close() |
| 28 except IOError: | 28 except IOError: |
| 29 print('There was a failure while trying to send the stack trace. Too bad.'
) | 29 print('There was a failure while trying to send the stack trace. Too bad.'
) |
| 30 | 30 |
| 31 | 31 |
| 32 @atexit.register | 32 #@atexit.register |
| 33 def CheckForException(): | 33 def CheckForException(): |
| 34 if 'test' in sys.modules['__main__'].__file__: | 34 if 'test' in sys.modules['__main__'].__file__: |
| 35 # Probably a unit test. | 35 # Probably a unit test. |
| 36 return | 36 return |
| 37 last_tb = getattr(sys, 'last_traceback', None) | 37 last_tb = getattr(sys, 'last_traceback', None) |
| 38 if last_tb: | 38 if last_tb: |
| 39 SendStack(''.join(traceback.format_tb(last_tb))) | 39 SendStack(''.join(traceback.format_tb(last_tb))) |
| OLD | NEW |