Catch Exception when necessary
authorJeremy Stanley <fungi@yuggoth.org>
Thu, 9 Nov 2017 05:29:24 +0000 (05:29 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Thu, 9 Nov 2017 05:34:17 +0000 (05:34 +0000)
In situations where any exception needs to be matched in an except
clause, specify the Exception base class so as to be explicit that
it's an intentional choice and not an accidental omission.

mudpy/tests/selftest.py

index 500356f..6239599 100644 (file)
@@ -270,7 +270,7 @@ def main():
             try:
                 captures[conversant] += lusers[
                     conversant].read_very_eager().decode("utf-8")
-            except:
+            except Exception:
                 pass
             if index is not 0:
                 print("ERROR: luser%s did not receive expected string:\n\n"
@@ -291,7 +291,7 @@ def main():
         try:
             captures[conversant] += lusers[
                 conversant].read_very_eager().decode("utf-8")
-        except:
+        except Exception:
             pass
         lusers[conversant].close()
         logfile = "capture_%s.log" % conversant