Let's say I have a methodA that raises an exception:
def methodA(x, y):
if y != 0:
z = x / y
return z
else:
raise ZeroDivisionError("zero can not be a denominator")
And in methodB I called methodA without handling the exception:
def methodB(x, y):
print methodA(x, y)
Here I want something that could warn me there is a potential risk of ZeroDivisionError
in methodB, and that it's better to catch it.
Is there any way to add some certain codes in methodA, or can we use some tool to find that I ignored some important exceptions?