diff options
-rw-r--r-- | docs/creating.rst | 8 | ||||
-rw-r--r-- | jsonschema.py | 14 |
2 files changed, 8 insertions, 14 deletions
diff --git a/docs/creating.rst b/docs/creating.rst index e5ded7f..ba1d417 100644 --- a/docs/creating.rst +++ b/docs/creating.rst @@ -7,3 +7,11 @@ Creating or Extending Validators .. currentmodule:: jsonschema .. autofunction:: validates + + +Creating Validation Errors +-------------------------- + +Any validating function that recurses into an instance (e.g. ``properties`` or +``items``) must append to the :exc:`ValidationError.path` attribute of the +error in order to properly maintain where in the instance the error occurred. diff --git a/jsonschema.py b/jsonschema.py index 6e8fe05..660a7de 100644 --- a/jsonschema.py +++ b/jsonschema.py @@ -89,20 +89,6 @@ def validates(version): return _validates -class ValidationError(Exception): - def __init__(self, message, validator=None, path=()): - # Any validator that recurses (e.g. properties and items) must append - # to the ValidationError's path to properly maintain where in the - # instance the error occurred - super(ValidationError, self).__init__(message, validator, path) - self.message = message - self.path = list(path) - self.validator = validator - - def __str__(self): - return self.message - - @validates("draft3") class Draft3Validator(object): """ |