Source Code:
(back to article)
class MyCustomException(Exception): def __init__(self, message): self.message = message try: raise MyCustomException("An error occurred") except MyCustomException as e: print(e.message)
Result:
Report an issue