bandit/examples/try_except_pass.py
Tim Kelsey 2da53779a6 Adding test for Try, Except, Pass
Ignoring errors is bad in general, you should at least log it. This
is a security problem as increased exceptions from a service may
indicate attempts to break/fuzz it.

Change-Id: I8f6ad98a3f3dccb89d15f2e50beeaf4ce093323a
2015-07-14 13:12:01 +01:00

37 lines
266 B
Python

# bad
try:
a = 1
except:
pass
# bad
try:
a = 1
except Exception:
pass
# bad
try:
a = 1
except ZeroDivisionError:
pass
except:
a = 2
# good
try:
a = 1
except:
a = 2
# silly, but ok
try:
a = 1
except:
pass
a = 2