I want to make a decorator which will catch exceptions and adequately logged their.
def logger(foo):
try:
print foo()
except Exception as e:
print e
@logger
def d():
return 2/2
if __name__ == '__main__':
d()
Thats right i think, but then I run it and I have an exception like this:
1
Traceback (most recent call last):
File "log.py", line 14, in <module>
d()
TypeError: 'NoneType' object is not callable
Why interpreter tells me that the function has None type, but call it and print answer?