Python - How to catch outside exceptions inside methods
Posted
by Gabriel L. Oliveira
on Stack Overflow
See other posts from Stack Overflow
or by Gabriel L. Oliveira
Published on 2010-05-06T21:35:11Z
Indexed on
2010/05/06
21:38 UTC
Read the original article
Hit count: 261
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?
© Stack Overflow or respective owner