
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
37 lines
266 B
Python
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
|