Skip to content

Instantly share code, notes, and snippets.

@adamserafini
Created January 16, 2015 16:01
Show Gist options
  • Save adamserafini/69f37cd8dc7678548b3b to your computer and use it in GitHub Desktop.
Save adamserafini/69f37cd8dc7678548b3b to your computer and use it in GitHub Desktop.
Python Exceptions
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