traffic: avoid bare except: clauses
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 19 Oct 2018 04:19:29 +0000 (17:19 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 8 Jan 2019 22:55:34 +0000 (23:55 +0100)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/emulate/traffic.py

index e11795879f27ac4c10cee09bc9103c82b03074e0..691439a1c102459cf3713f4174ffc9ae60a3f08c 100644 (file)
@@ -484,7 +484,7 @@ class ReplayContext(object):
                 random.random() < self.badpassword_frequency):
                 try:
                     f(bad)
-                except:
+                except Exception:
                     # Ignore any exceptions as the operation may fail
                     # as it's being performed with bad credentials
                     pass
@@ -2235,7 +2235,7 @@ def opcode_key(v):
     """Sort key for the operation code to ensure that it sorts numerically"""
     try:
         return "%03d" % int(v)
-    except:
+    except ValueError:
         return v