Skip to content

Instantly share code, notes, and snippets.

@koss822
Created June 22, 2023 20:31
Show Gist options
  • Save koss822/c82bf23efef008956956d9ad63545919 to your computer and use it in GitHub Desktop.
Save koss822/c82bf23efef008956956d9ad63545919 to your computer and use it in GitHub Desktop.
class ExtendedException(Exception):
"""This exception extends functionality"""
error_message = None
error_code = None
def __init__(self, error_message = None, error_code = None):
self.error_message = error_message
self.error_code = error_code
try:
raise ExtendedException("This is error", 400)
except ExtendedException as e:
print(f"Error message: {e.error_message}, Error code: {e.error_code}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment