From 3b34821c86a33965c00098fe48384e8784ee9173 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 8 Mar 2018 13:57:13 +0530 Subject: [PATCH] Report unhandled exceptions during loop initialization in the unicode input kitten as well --- kittens/unicode_input/main.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kittens/unicode_input/main.py b/kittens/unicode_input/main.py index 5bf9cf8f1..730052981 100644 --- a/kittens/unicode_input/main.py +++ b/kittens/unicode_input/main.py @@ -454,7 +454,7 @@ class UnicodeInput(Handler): self.refresh() -def main(args=sys.argv): +def run_loop(args): loop = Loop() with cached_values_for('unicode-input') as cached_values: handler = UnicodeInput(cached_values) @@ -467,4 +467,13 @@ def main(args=sys.argv): pass recent = [ord(handler.current_char)] + handler.recent cached_values['recent'] = recent[:len(DEFAULT_SET)] - raise SystemExit(loop.return_code) + return loop.return_code + + +def main(args=sys.argv): + try: + raise SystemExit(run_loop(args)) + except Exception: + import traceback + traceback.print_exc() + input(_('Press Enter to quit.'))