barker/barker/models/validation_exception.py

12 lines
344 B
Python
Raw Normal View History

2019-06-15 17:39:43 +00:00
class ValidationError(Exception):
def __init__(self, message, errors=None):
self.message = message
# Call the base class constructor with the parameters it needs
Exception.__init__(self, message)
# Now for your custom code...
self.errors = errors
def __str__(self):
return self.message