From 39fb31847ce65f0369c11927ca4b349897a71001 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Wed, 27 Dec 2006 20:00:17 -0800 Subject: [PATCH 1/1] [RARSLAVE] Catch exceptions from par2parser Add try / except blocks to catch exceptions that happen in the par2parser class. Signed-off-by: Ira W. Snyder --- rarslave.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rarslave.py b/rarslave.py index 2096a97..8caf29e 100644 --- a/rarslave.py +++ b/rarslave.py @@ -208,7 +208,11 @@ def find_likely_files (dir, p2file): regex = re.compile ('^%s.*$' % (ename, )) name_matches = [f for f in os.listdir (dir) if regex.match (f)] - parsed_matches = par2parser.get_protected_files (dir, p2file) + try: + parsed_matches = par2parser.get_protected_files (dir, p2file) + except EnvironmentError: + parsed_matches = [] + logger.addMessage ('Bad par2 file: %s' % p2file, RarslaveLogger.MessageType.Fatal) return name_matches + parsed_matches @@ -279,7 +283,7 @@ def find_extraction_heads (dir, files): try: prot_files = par2parser.get_protected_files (dir, f) done = True - except: #FIXME: add the actual exceptions + except EnvironmentError: logger.addMessage ('Error parsing PAR2 file: %s', f) continue -- 2.25.1