CSIT-1110: Print NameError to reduce confusion 49/12849/3
authorVratko Polak <vrpolak@cisco.com>
Mon, 4 Jun 2018 13:33:10 +0000 (15:33 +0200)
committerVratko Polak <vrpolak@cisco.com>
Mon, 4 Jun 2018 13:33:10 +0000 (15:33 +0200)
See https://gerrit.fd.io/r/12724
for an example mistake which also can cause NameError.

Change-Id: I65c74744c027800a95014f3be48d0f522a10ce2b
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
resources/tools/presentation/generator_files.py
resources/tools/presentation/generator_plots.py
resources/tools/presentation/generator_tables.py

index e717815..4268d34 100644 (file)
@@ -43,9 +43,9 @@ def generate_files(spec, data):
     for file_spec in spec.files:
         try:
             eval(file_spec["algorithm"])(file_spec, data)
-        except NameError:
-            logging.error("The algorithm '{0}' is not defined.".
-                          format(file_spec["algorithm"]))
+        except NameError as err:
+            logging.error("Probably algorithm '{alg}' is not defined: {err}".
+                          format(alg=file_spec["algorithm"], err=repr(err))
     logging.info("Done.")
 
 
index 6faf4c3..d89d68f 100644 (file)
@@ -39,9 +39,9 @@ def generate_plots(spec, data):
         try:
             logging.info("  Plot nr {0}:".format(index + 1))
             eval(plot["algorithm"])(plot, data)
-        except NameError:
-            logging.error("The algorithm '{0}' is not defined.".
-                          format(plot["algorithm"]))
+        except NameError as err:
+            logging.error("Probably algorithm '{alg}' is not defined: {err}".
+                          format(alg=plot["algorithm"], err=repr(err))
     logging.info("Done.")
 
 
index 4fdd8c5..f555fce 100644 (file)
@@ -43,9 +43,9 @@ def generate_tables(spec, data):
     for table in spec.tables:
         try:
             eval(table["algorithm"])(table, data)
-        except NameError:
-            logging.error("The algorithm '{0}' is not defined.".
-                          format(table["algorithm"]))
+        except NameError as err:
+            logging.error("Probably algorithm '{alg}' is not defined: {err}".
+                          format(alg=table["algorithm"], err=repr(err))
     logging.info("Done.")
 
 

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.