diff options
author | kali <kali@leap.se> | 2013-01-31 09:09:54 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2013-01-31 09:09:54 +0900 |
commit | fff2c771cc9c93cf566f586c3c033fed7266ea27 (patch) | |
tree | c659fd5df2256e8daea81ef8562ed4929595c94d /src/leap/base/pluggableconfig.py | |
parent | 65b8541ce9624684cde7394b6dd96a31d4204453 (diff) |
hide jsonschema exception in tests
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() |