Add some comments and exceptions
authorAlexander Vasarab <alexander@wylark.com>
Mon, 30 Nov 2020 01:31:46 +0000 (17:31 -0800)
committerAlexander Vasarab <alexander@wylark.com>
Mon, 30 Nov 2020 01:31:46 +0000 (17:31 -0800)
examples/custom-wx.example.py
infoex-autowx.py

index 565e71fa79cda1df540022d46447eda7fa01e801..0b2cc42a08adfbdfc557971559114d863bb0e6c8 100644 (file)
@@ -27,5 +27,9 @@ def get_custom_data():
     # Whatever your program needs to do to get its data can be done
     # either here in this function directly, or elsewhere with
     # modification to the global variable `wx_data`.
     # Whatever your program needs to do to get its data can be done
     # either here in this function directly, or elsewhere with
     # modification to the global variable `wx_data`.
+    #
+    # NOTE: The LOG class from infoex-autowx is available, so you may
+    #       issue e.g. LOG.info('some helpful information') in your
+    #       program.
 
     return wx_data
 
     return wx_data
index f285c42ae44de8fee51a9ee05afb055b3e8b58f2..c191e5c767c627f539ab1c8194ab8f6314ce5c81 100755 (executable)
@@ -228,9 +228,9 @@ def main():
 
                 if infoex['wx_data'] is None:
                     infoex['wx_data'] = []
 
                 if infoex['wx_data'] is None:
                     infoex['wx_data'] = []
-            except Exception:
+            except Exception as exc:
                 LOG.error("Python program for custom Wx data failed in "
                 LOG.error("Python program for custom Wx data failed in "
-                          "execution")
+                          "execution: " + str(exc))
                 sys.exit(1)
 
             LOG.info("Successfully executed external Python program")
                 sys.exit(1)
 
             LOG.info("Successfully executed external Python program")
@@ -241,6 +241,10 @@ def main():
             LOG.error("Specified Python program for custom Wx data "
                       "was not found")
             sys.exit(1)
             LOG.error("Specified Python program for custom Wx data "
                       "was not found")
             sys.exit(1)
+        except Exception as exc:
+            LOG.error("A problem was encountered when attempting to "
+                      "load your custom Wx program: " + str(exc))
+            sys.exit(1)
 
     LOG.info("Time taken to get all data : %.3f sec", time.time() -
              time_all_elements)
 
     LOG.info("Time taken to get all data : %.3f sec", time.time() -
              time_all_elements)