spock
6/11/2017 - 11:36 AM

Writing custom exceptions.

Writing custom exceptions.

# custom exception:
class MyException(Exception):
    pass
    
# or inherit from other exception type:
class NameTooShortError(ValueError):
    pass