diff options
author | martinko | 2013-04-24 12:13:58 +0000 |
---|---|---|
committer | martinko | 2013-04-24 12:13:58 +0000 |
commit | c3d00f0ba488ffc3aab36842dfd6bcde3e1e72e9 (patch) | |
tree | 894e18e2dcedab689dd8f7f3e26fae6f2b3e23c9 /python/skytools/scripting.py | |
parent | 4efb39fd4c167b10a973f87eccdf2c20384611b5 (diff) |
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().
Diffstat (limited to 'python/skytools/scripting.py')
-rw-r--r-- | python/skytools/scripting.py | 5 |
1 files changed, 4 insertions, 1 deletions
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) |