Created
October 1, 2012 12:44
-
-
Save lambdaman2/3811451 to your computer and use it in GitHub Desktop.
Python: Catching and throwing exceptions
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
--- catch: | |
try: | |
generateSomeException() | |
except Exception, e: # Mother of all exceptions | |
print e | |
--- throw: | |
try: | |
raise Exception, "Something is rotten in the state of Denmark" | |
except e: | |
print e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment