Skip to content
Browse files

Bug 839455 - Use new exception handling syntax in Python code. r=dhunt

  • Loading branch information...
1 parent 8e8f3ca commit d37b5d5afba6241735ea4cbc644d865bb97b485f @berkerpeksag berkerpeksag committed with davehunt
View
4 jsbridge/jsbridge/network.py
@@ -159,7 +159,7 @@ def run(self, _uuid, exec_string, interval=.2, raise_exeption=True):
exec_string += '\r\n'
try:
self.send(exec_string)
- except Exception, e:
+ except Exception as e:
print str(e)
print "String: %s" % exec_string
@@ -235,7 +235,7 @@ def process_read(self, data):
# Try to get a json object from the data stream
try:
obj, index = decoder.raw_decode(self.sbuffer)
- except Exception, e:
+ except Exception:
self.parsing = False
# If we got an object fire the callback infra
if self.parsing:
View
4 mozmill/mozmill/__init__.py
@@ -607,7 +607,7 @@ def testname(t):
# user handlers
try:
handler_class = handlers.load_handler(handler)
- except BaseException, e:
+ except BaseException as e:
self.parser.error(str(e))
_handler = handlers.instantiate_handler(handler_class,
self.options)
@@ -744,7 +744,7 @@ def run(self):
try:
mozmill.start_runner()
mozmill.runner.wait()
- except JSBridgeDisconnectError, KeyboardInterrupt:
+ except (JSBridgeDisconnectError, KeyboardInterrupt):
pass
return
View
2 mozmill/mozmill/python_callbacks.py
@@ -30,7 +30,7 @@ def fire(self, obj):
module = imp.load_source('callbacks', path)
method = getattr(module, obj['method'])
method(*obj.get('args', []), **obj.get('kwargs', {}))
- except BaseException, e:
+ except BaseException as e:
print "PythonCallbacks error:"
print repr(e)
raise
View
8 mozmill/mozmill/report.py
@@ -10,7 +10,7 @@
try:
import json
-except:
+except ImportError:
import simplejson as json
from handlers import HandlerMatchException
@@ -81,7 +81,7 @@ def send_report(self, results, report_url):
filename = report_url.split('file://', 1)[1]
try:
f = file(filename, 'w')
- except Exception, e:
+ except Exception as e:
print "Printing results to '%s' failed (%s)." % (filename, e)
return
if f:
@@ -108,10 +108,10 @@ def send_report(self, results, report_url):
print "Report document created at '%s%s'" % (report_url,
data['id'])
return data
- except urllib2.HTTPError, e:
+ except urllib2.HTTPError as e:
data = json.loads(e.read())
print "Sending results to '%s' failed (%s)." % (report_url,
data['reason'])
- except urllib2.URLError, e:
+ except urllib2.URLError as e:
print "Sending results to '%s' failed (%s)." % (report_url,
e.reason)
View
4 mutt/mutt/mutt.py
@@ -146,14 +146,14 @@ def test_all(tests, options):
pyresult = test_all_python(pytests, options)
if pyresult.failures or pyresult.errors:
fail = True
- except SystemExit, e:
+ except SystemExit as e:
fail = (e.code != 0) or fail
try:
jsresult = test_all_js(jstests, options)
if jsresult.fails:
fail = True
- except SystemExit, e:
+ except SystemExit as e:
fail = (e.code != 0) or fail
# XXX unify this with main function below

0 comments on commit d37b5d5

Please sign in to comment.
Something went wrong with that request. Please try again.