From 074316105bd32a92ab1f1863c6f2a3353c1365fc Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 29 Nov 2012 08:48:35 -0500 Subject: [PATCH] zephyr_mirror: Replace bare excepts with 'except Exception'. (imported from commit 857212e0e5116471e418d37845550108c0a47d2b) --- bots/zephyr_mirror_backend.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 1b699d2..1f93f9d 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -186,7 +186,7 @@ def update_subscriptions_from_humbug(): else: logger.error("Error getting public streams:\n%s" % res) return - except: + except Exception: logger.exception("Error getting public streams:") return streams_to_subscribe = [] @@ -222,7 +222,7 @@ def maybe_restart_mirroring_script(): while True: try: os.execvp(os.path.join(options.root_path, "user_root", "zephyr_mirror_backend.py"), sys.argv) - except: + except Exception: logger.exception("Error restarting mirroring script; trying again... Traceback:") time.sleep(1) @@ -350,7 +350,7 @@ def decode_unicode_byte_strings(zeph): if isinstance(zeph[field], str): try: decoded = zeph[field].decode("utf-8") - except: + except Exception: decoded = zeph[field].decode("iso-8859-1") zeph[field] = decoded return zeph @@ -397,7 +397,7 @@ def zephyr_to_humbug(options): (zeph.get('stream', zeph.get('recipient')), zeph['sender'])) send_humbug(zeph) - except: + except Exception: logger.exception("Could not send saved zephyr:") time.sleep(2) @@ -536,7 +536,7 @@ def maybe_forward_to_zephyr(message): return try: forward_to_zephyr(message) - except: + except Exception: # Don't let an exception forwarding one message crash the # whole process logger.exception("Error forwarding message:") @@ -672,7 +672,7 @@ def parse_zephyr_subs(verbose=False): if verbose: print >>sys.stderr, "Skipping subscription to unsupported class name: [%s]" % (line,) continue - except: + except Exception: if verbose: print >>sys.stderr, "Couldn't parse ~/.zephyr.subs line: [%s]" % (line,) continue @@ -687,7 +687,7 @@ def fetch_fullname(username): out, _err_unused = proc.communicate() if proc.returncode == 0: return out.split(':')[4].split(',')[0] - except: + except Exception: logger.exception("Error getting fullname for %s:" % (username,)) return username