Created
January 16, 2015 16:01
-
-
Save adamserafini/69f37cd8dc7678548b3b to your computer and use it in GitHub Desktop.
Python 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
class SuperDuperException(Exception): | |
pass | |
def hi(): | |
raise SuperDuperException('aw shucks') | |
if __name__ == '__main__': | |
try: | |
hi() | |
except SuperDuperException as e: | |
print 'I received the error message: %s' % e.args[0] | |
finally: | |
print 'Entering sleep mode!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment