Created
November 12, 2018 00:02
-
-
Save utkjad/fa1f0d0befadbf4b538be89d489a559c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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