__author__ = 'tanshu' 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 def json(self): return self.message