From c3d00f0ba488ffc3aab36842dfd6bcde3e1e72e9 Mon Sep 17 00:00:00 2001 From: martinko Date: Wed, 24 Apr 2013 15:13:58 +0300 Subject: skytools.scripting: more safety in run_func_safely() Scenario resolved: startup() fails and some variables are never initialised. those are used in overridden send_stats() which is called from generic exception handler in run_func_safely(). thus a new exception is raised that would obscure the original exception raised in startup(). --- python/skytools/scripting.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'python/skytools/scripting.py') diff --git a/python/skytools/scripting.py b/python/skytools/scripting.py index a5e82663..840f3cf4 100644 --- a/python/skytools/scripting.py +++ b/python/skytools/scripting.py @@ -588,7 +588,10 @@ class BaseScript(object): self.reset() sys.exit(1) except Exception, d: - self.send_stats() + try: # this may fail too + self.send_stats() + except: + pass emsg = str(d).rstrip() self.reset() self.exception_hook(d, emsg) -- cgit v1.2.3