From 92f98e9f5122c9d7259910ad426b0953b1c3e008 Mon Sep 17 00:00:00 2001 From: fpdb-mme Date: Tue, 3 Nov 2009 16:09:58 +0100 Subject: [PATCH] added an application wide exception handler --- pyfpdb/Configuration.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index a9fa0d93..1f47b61b 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -59,6 +59,14 @@ DATABASE_TYPES = ( logging.config.fileConfig(os.path.join(DIR_SELF,"logging.conf")) log = logging.getLogger("config") +# setup application wide exception handler +def excepthook(Type, value, tb): + p = traceback.format_exception(type, value, tb) + log.critical(p) + raise Type(value) + +sys.excepthook = excepthook + ######################################################################## def string_to_bool(string, default=True): """converts a string representation of a boolean value to boolean True or False @@ -140,7 +148,7 @@ class Site: if self.ypad == "": self.ypad = 0 else: self.ypad = int(self.ypad) - + if self.font_size == "": self.font_size = 7 else: self.font_size = int(self.font_size)