Python - How to catch outside exceptions inside methods
- by Gabriel L. Oliveira
I want to know if there would be a way to catch exceptions inside called methods.
Example:
def foo(value):
print value
method(x)
This would throw a NameError exception, cause x is not declared.
I'd like to catch this NameError exception inside foo method.
Is there a way?