diff options
Diffstat (limited to 'src/leap/base/pluggableconfig.py')
-rw-r--r-- | src/leap/base/pluggableconfig.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/leap/base/pluggableconfig.py b/src/leap/base/pluggableconfig.py index 3517db6b..6f9f3f6f 100644 --- a/src/leap/base/pluggableconfig.py +++ b/src/leap/base/pluggableconfig.py @@ -26,6 +26,10 @@ __all__ = ['PluggableConfig', # exceptions +class ValidationError(Exception): + pass + + class UnknownOptionException(Exception): """exception raised when a non-configuration value is present in the configuration""" @@ -107,7 +111,10 @@ class JSONAdaptor(ConfigAdaptor): def validate(self, config, schema_obj): schema_json = JSONSchemaEncoder().encode(schema_obj) schema = json.loads(schema_json) - jsonschema.validate(config, schema) + try: + jsonschema.validate(config, schema) + except jsonschema.ValidationError: + raise ValidationError adaptors['json'] = JSONAdaptor() |