Skip to content

Instantly share code, notes, and snippets.

@SatishGodaPearl
Last active August 13, 2019 00:15
Show Gist options
  • Save SatishGodaPearl/ada9420221c7c7c55a71584c74f05666 to your computer and use it in GitHub Desktop.
Save SatishGodaPearl/ada9420221c7c7c55a71584c74f05666 to your computer and use it in GitHub Desktop.
Python Exception Handling

The definitive guide to Python exceptions

https://julien.danjou.info/python-exceptions-guide/

Python Exceptions: An Introduction

https://realpython.com/python-exceptions/

Professional Error Handling With Python

https://code.tutsplus.com/tutorials/professional-error-handling-with-python--cms-25950

How to Best Use Try Except in Python – Especially for Beginners

https://www.techbeamers.com/use-try-except-python/

Clean code and the art of exception handling

https://www.cryptextechnologies.com/blogs/clean-code-and-the-art-of-exception-handling

# https://docs.python.org/2/library/errno.html
import os
import errno
try:
os.makedirs(tempDir)
except WindowsError as e:
if e.errno == errno.EEXIST:
raise TempDirectoryCleanupError(e.strerror)
err.winerror
err.strerror
import errno
errorcode = errno.errorcode[err.errno]
err.strerror
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment