|
@@ -13,14 +13,19 @@ import traceback
|
|
import socket
|
|
import socket
|
|
import sys
|
|
import sys
|
|
|
|
|
|
|
|
+# Configure these values.
|
|
|
|
+DEFAULT_URL = 'http://chromium-status.appspot.com/breakpad'
|
|
|
|
|
|
-def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'):
|
|
|
|
|
|
+def SendStack(last_tb, stack, url=None):
|
|
|
|
+ if not url:
|
|
|
|
+ url = DEFAULT_URL
|
|
print 'Sending crash report ...'
|
|
print 'Sending crash report ...'
|
|
try:
|
|
try:
|
|
params = {
|
|
params = {
|
|
'args': sys.argv,
|
|
'args': sys.argv,
|
|
'stack': stack,
|
|
'stack': stack,
|
|
'user': getpass.getuser(),
|
|
'user': getpass.getuser(),
|
|
|
|
+ 'exception': last_tb,
|
|
}
|
|
}
|
|
request = urllib.urlopen(url, urllib.urlencode(params))
|
|
request = urllib.urlopen(url, urllib.urlencode(params))
|
|
print request.read()
|
|
print request.read()
|
|
@@ -30,9 +35,11 @@ def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'):
|
|
|
|
|
|
|
|
|
|
def CheckForException():
|
|
def CheckForException():
|
|
- last_tb = getattr(sys, 'last_traceback', None)
|
|
|
|
- if last_tb and sys.last_type is not KeyboardInterrupt:
|
|
|
|
- SendStack(''.join(traceback.format_tb(last_tb)))
|
|
|
|
|
|
+ last_value = getattr(sys, 'last_value', None)
|
|
|
|
+ if last_value and not isinstance(last_value, KeyboardInterrupt):
|
|
|
|
+ last_tb = getattr(sys, 'last_traceback', None)
|
|
|
|
+ if last_tb:
|
|
|
|
+ SendStack(repr(last_value), ''.join(traceback.format_tb(last_tb)))
|
|
|
|
|
|
|
|
|
|
if (not 'test' in sys.modules['__main__'].__file__ and
|
|
if (not 'test' in sys.modules['__main__'].__file__ and
|