More messing with the unhandled / non-zero record code.
[pyutils.git] / src / pyutils / bootstrap.py
index 18cbc274a71083eb4526dccf18464147cb7e144c..a8dd5a11bcacc76382d0a9ca2834ed431c453f9b 100644 (file)
@@ -118,10 +118,7 @@ def handle_uncaught_exception(exc_type, exc_value, exc_tb):
     msg = f"Unhandled top level exception {exc_type}"
     logger.exception(msg)
     print(msg, file=sys.stderr)
-    try:
-        logging_utils.unhandled_top_level_exception(exc_type, exc_value, exc_tb)
-    except Exception:
-        pass
+    logging_utils.unhandled_top_level_exception(exc_type, exc_value, exc_tb)
     if issubclass(exc_type, KeyboardInterrupt):
         sys.__excepthook__(exc_type, exc_value, exc_tb)
         return
@@ -434,8 +431,8 @@ def initialize(entry_point):
         # If it doesn't return cleanly, call attention to the return value.
         base_filename = os.path.basename(entry_filename)
         if ret is not None and ret != 0:
-            logger.error("%s: Exit %s", base_filename, ret)
-            logging_utils.non_zero_return_value(ret)
+            if not logging_utils.non_zero_return_value(ret):
+                logger.error("%s: Exit %s", base_filename, ret)
         else:
             logger.debug("%s: Exit %s", base_filename, ret)
         sys.exit(ret)