Add error type to `ExceptionRecord`. (#836)
So it's easier for parsers to get this info.
diff --git a/mobly/records.py b/mobly/records.py
index f4ec4d5..de7eb69 100644
--- a/mobly/records.py
+++ b/mobly/records.py
@@ -217,6 +217,7 @@
Attributes:
exception: Exception object, the original Exception.
+ type: string, type name of the exception object.
stacktrace: string, stacktrace of the Exception.
extras: optional serializable, this corresponds to the
`TestSignal.extras` field.
@@ -226,6 +227,7 @@
def __init__(self, e, position=None):
self.exception = e
+ self.type = type(e).__name__
self.stacktrace = None
self.extras = None
self.position = position
diff --git a/tests/mobly/records_test.py b/tests/mobly/records_test.py
index f3758f5..1c00044 100755
--- a/tests/mobly/records_test.py
+++ b/tests/mobly/records_test.py
@@ -406,6 +406,7 @@
new_er = copy.deepcopy(er)
self.assertIsNot(er, new_er)
self.assertDictEqual(er.to_dict(), new_er.to_dict())
+ self.assertEqual(er.type, 'RecordTestError')
def test_add_controller_info_record(self):
tr = records.TestResult()