trex-console: add print of Python error in case of error loading profile in TUI
authorYaroslav Brustinov <[email protected]>
Wed, 28 Sep 2016 11:22:31 +0000 (14:22 +0300)
committerYaroslav Brustinov <[email protected]>
Wed, 28 Sep 2016 11:22:31 +0000 (14:22 +0300)
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py

index 3fe31d4..b5ae0f9 100755 (executable)
@@ -2867,10 +2867,14 @@ class STLClient(object):
                 self.add_streams(profile.get_streams(), ports = port)
 
         except STLError as e:
-            msg = format_text("\nError while loading profile '{0}'\n".format(opts.file[0]), 'bold')
-            self.logger.log(msg)
+            error = 'Unknown error.'
+            for line in e.brief().split('\n'):
+                if line:
+                    error = line
+            msg = format_text("\nError loading profile '{0}'".format(opts.file[0]), 'bold')
+            self.logger.log(msg + '\n')
             self.logger.log(e.brief() + "\n")
-            return RC_ERR(msg)
+            return RC_ERR("%s: %s" % (msg, error))
 
 
         if opts.dry: