[Mpuls-commits] r5898 - base/trunk/mpulsweb/lib

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 9 12:46:11 CET 2012


Author: bricks
Date: 2012-03-09 12:46:11 +0100 (Fri, 09 Mar 2012)
New Revision: 5898

Modified:
   base/trunk/mpulsweb/lib/app_globals.py
Log:
Log error if the application case module couldn't be loaded

Sometimes it should be better to not even start the application
if the module couldn't be loaded. But at least log the error message
of the exception to give a hint about the cause.


Modified: base/trunk/mpulsweb/lib/app_globals.py
===================================================================
--- base/trunk/mpulsweb/lib/app_globals.py	2012-03-09 11:39:35 UTC (rev 5897)
+++ base/trunk/mpulsweb/lib/app_globals.py	2012-03-09 11:46:11 UTC (rev 5898)
@@ -171,8 +171,12 @@
             self.case = Case
             CaseFactory = case_module.CaseFactory
             self.case_factory = case_module.CaseFactory(self.case)
-        except:
-            log.warning('Not found "model.case in overridable module. Taking case from base"')
+        except Exception, e:
+            # it would be better to not catch all exceptions here
+            # an application should eventually not start if a case module
+            # couldn't be loaded. At least log the reason as error
+            log.error("Error loading 'model.case' from overridable module."
+                      "Taking case from base. Exception was %s", e)
             self.case = MpulsCase
             self.case_factory = MpulsCaseFactory(self.case)
 



More information about the Mpuls-commits mailing list