@@ -1182,13 +1182,13 @@ def runjob(control, drop_caches, options):
sys.exit(1)
except error.JobError, instance:
- logging.error("JOB ERROR: " + instance.args[0])
+ logging.error("JOB ERROR: " + str(instance))
if myjob:
command = None
if len(instance.args) > 1:
command = instance.args[1]
- myjob.record('ABORT', None, command, instance.args[0])
- myjob.record('END ABORT', None, None, instance.args[0])
+ myjob.record('ABORT', None, command, str(instance))
+ myjob.record('END ABORT', None, None, str(instance))
assert myjob._record_indent == 0
myjob.complete(1)
else:
@@ -44,14 +44,19 @@ class JobError(AutotestError):
class UnhandledJobError(JobError):
"""Indicates an unhandled error in a job."""
def __init__(self, unhandled_exception):
- if isinstance(unhandled_exception, JobError):
- JobError.__init__(self, *unhandled_exception.args)
+ JobError.__init__(self, unhandled_exception)
+ self.unhandled_exception = unhandled_exception
+ self.traceback = traceback.format_exc()
+
+ def __str__(self):
+ if isinstance(self.unhandled_exception, JobError):
+ return JobError.__str__(self.unhandled_exception)
else:
msg = "Unhandled %s: %s"
- msg %= (unhandled_exception.__class__.__name__,
- unhandled_exception)
- msg += "\n" + traceback.format_exc()
- JobError.__init__(self, msg)
+ msg %= (self.unhandled_exception.__class__.__name__,
+ self.unhandled_exception)
+ msg += "\n" + self.traceback
+ return msg
class TestBaseException(AutotestError):
@@ -85,27 +90,37 @@ class TestWarn(TestBaseException):
class UnhandledTestError(TestError):
"""Indicates an unhandled error in a test."""
def __init__(self, unhandled_exception):
- if isinstance(unhandled_exception, TestError):
- TestError.__init__(self, *unhandled_exception.args)
+ TestError.__init__(self, unhandled_exception)
+ self.unhandled_exception = unhandled_exception
+ self.traceback = traceback.format_exc()
+
+ def __str__(self):
+ if isinstance(self.unhandled_exception, TestError):
+ return TestError.__str__(self.unhandled_exception)
else:
msg = "Unhandled %s: %s"
- msg %= (unhandled_exception.__class__.__name__,
- unhandled_exception)
- msg += "\n" + traceback.format_exc()
- TestError.__init__(self, msg)
+ msg %= (self.unhandled_exception.__class__.__name__,
+ self.unhandled_exception)
+ msg += "\n" + self.traceback
+ return msg
class UnhandledTestFail(TestFail):
"""Indicates an unhandled fail in a test."""
def __init__(self, unhandled_exception):
- if isinstance(unhandled_exception, TestFail):
- TestFail.__init__(self, *unhandled_exception.args)
+ TestFail.__init__(self, unhandled_exception)
+ self.unhandled_exception = unhandled_exception
+ self.traceback = traceback.format_exc()
+
+ def __str__(self):
+ if isinstance(self.unhandled_exception, TestFail):
+ return TestFail.__str__(self.unhandled_exception)
else:
msg = "Unhandled %s: %s"
- msg %= (unhandled_exception.__class__.__name__,
- unhandled_exception)
- msg += "\n" + traceback.format_exc()
- TestFail.__init__(self, msg)
+ msg %= (self.unhandled_exception.__class__.__name__,
+ self.unhandled_exception)
+ msg += "\n" + self.traceback
+ return msg
class CmdError(TestError):