From e699be5c6da9815812555565f6190979dac91900 Mon Sep 17 00:00:00 2001 From: Martinez Date: Tue, 2 May 2017 22:39:27 +0200 Subject: [PATCH] handles exceptions in containment callbacks --- over/app.py | 8 +++++++- over/file.py | 1 + over/version.py | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/over/app.py b/over/app.py index 0bbe893..98ff259 100644 --- a/over/app.py +++ b/over/app.py @@ -813,6 +813,12 @@ class Main: for i, (cb, ctx) in enumerate(self.uncontained_exception_callbacks): self.print("(%d/%d) %s" %(i+1, l, cb.__name__)) - cb(*ctx) + try: + cb(*ctx) + except Exception as e: + self.print("(%d/%d) %s failed<.> (%s<.>)" %(i+1, l, cb.__name__, e.__class__.__name__), self.print.tl.epic, end=":\n") + exc_info = sys.exc_info() + traceback.print_exception(*exc_info) + del exc_info self.print("containment callbacks executed", self.print.tl.done) diff --git a/over/file.py b/over/file.py index 6978299..e3e4450 100644 --- a/over/file.py +++ b/over/file.py @@ -46,6 +46,7 @@ def context_dir(path): """ A directory context manager. """ + previous = os.getcwd() os.chdir(path) diff --git a/over/version.py b/over/version.py index 70f0af0..bc4a5b0 100644 --- a/over/version.py +++ b/over/version.py @@ -4,5 +4,5 @@ major = 1 # VERSION_MAJOR_IDENTIFIER minor = 101 # VERSION_MINOR_IDENTIFIER # VERSION_LAST_MM 1.101 -patch = 0 # VERSION_PATCH_IDENTIFIER -str = "1.101.0" # VERSION_STRING_IDENTIFIER +patch = 1 # VERSION_PATCH_IDENTIFIER +str = "1.101.1" # VERSION_STRING_IDENTIFIER