Skip to content

Instantly share code, notes, and snippets.

@utkjad
Created November 12, 2018 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save utkjad/fa1f0d0befadbf4b538be89d489a559c to your computer and use it in GitHub Desktop.
Save utkjad/fa1f0d0befadbf4b538be89d489a559c to your computer and use it in GitHub Desktop.
def decoratorFunction(func):
print "In Decorator Before function call"
def _fn():
try:
ret = func()
return ret
except IOError as e:
print "I/O error"
rollback()
except ValueError as e:
print "Value error"
rollback2()
return _fn
def rollback():
print "in rollback"
def rollback2():
print "in rollback2"
@decoratorFunction
def functionAudience():
print "Inside functionAudience"
try:
h = 1 / 1
except Exception as e:
print "inside zerodivision error 1"
raise IOError()
return "Everything Went well"
if __name__ == '__main__':
hi = functionAudience()
import pdb;pdb.set_trace()
print "This would never get called in exception situation"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment