diff options
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py index 2ca92cb8..fa8163b8 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_exceptions.py @@ -17,14 +17,15 @@ class STLError(Exception): def __str__ (self): - fname = os.path.split(self.tb[-2][0])[1] - lineno = self.tb[-2][1] - func = self.tb[-2][2] - src = self.tb[-2][3] - - s = "\n******\n" - s += "Error at {0}:{1} - '{2}'\n\n".format(format_text(fname, 'bold'), format_text(lineno, 'bold'), format_text(src.strip(), 'bold')) - s += "specific error:\n\n{0}\n".format(format_text(self.msg, 'bold')) + s = format_text("\n******\n", 'bold') + s += format_text('\nSummary error report:\n\n', 'underline') + s += format_text(self.msg + '\n', 'bold') + + s += format_text("\nFull error report:\n\n", 'underline') + + for line in reversed(self.tb): + fname, lineno, func, src = os.path.split(line[0])[1], line[1], line[2], line[3] + s += " {:}:{:<20} - '{}'\n".format(format_text(fname, 'bold'), format_text(lineno, 'bold'), format_text(src.strip(), 'bold')) return s |