From bb587f4861743d263b0f07142e03afd45986be27 Mon Sep 17 00:00:00 2001 From: Urban Wallasch Date: Tue, 15 Jun 2021 18:26:03 +0200 Subject: [PATCH] * Print error messages for regex compiler exceptions. --- jiten-pai.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jiten-pai.py b/jiten-pai.py index d4eef5c..832d727 100755 --- a/jiten-pai.py +++ b/jiten-pai.py @@ -865,7 +865,8 @@ class jpMainWindow(QMainWindow): term = self.search_box.lineEdit().text() try: re_term = re.compile(kata2hira(term), re.IGNORECASE) - except: + except Exception as e: + eprint(term, str(e)) re_term = re.compile('', re.IGNORECASE) nfmt = '
' % (cfg['nfont'], cfg['nfont_sz']) lfmt = '' % (cfg['lfont'], cfg['lfont_sz']) @@ -905,7 +906,8 @@ def dict_lookup(dict_fname, pattern, mode, limit=0): with open(dict_fname) as dict_file: try: re_pattern = re.compile(pattern, re.IGNORECASE) - except: + except Exception as e: + eprint(pattern, str(e)) return result for line in dict_file: if limit and cnt >= limit: -- 2.30.2