Skip to content

Commit

Permalink
added more reports on validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
edoput committed Jun 7, 2017
1 parent 87b6250 commit bf64db8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion netjsonconfig/exceptions.py
Expand Up @@ -3,7 +3,13 @@ class NetJsonConfigException(Exception):
Root netjsonconfig exception
"""
def __str__(self):
return "%s %s %s" % (self.__class__.__name__, self.message, self.details)
suberrors = ''
for validator_value, error in zip(self.details.validator_value, self.details.context):
suberrors += '\nAgainst schema %s\n%s\n' % (validator_value, error.message,)

default_message = "%s %s\n" % (self.__class__.__name__, self.details,)

return default_message + suberrors


class ValidationError(NetJsonConfigException):
Expand Down

0 comments on commit bf64db8

Please sign in to comment.