12 lines
344 B
Python
12 lines
344 B
Python
|
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
|