summaryrefslogtreecommitdiff
path: root/src/leap/base/pluggableconfig.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-01-31 09:09:54 +0900
committerkali <kali@leap.se>2013-01-31 09:28:15 +0900
commitda8a8ac4ebc62f7549d2927c41472561541abfa2 (patch)
tree730c6423a6a8cc1d0ef2b1345f1affcbb1c332c2 /src/leap/base/pluggableconfig.py
parent8763866e0a4fc822f198e2e768993fdb9a38ef80 (diff)
hide jsonschema exception in tests
Diffstat (limited to 'src/leap/base/pluggableconfig.py')
-rw-r--r--src/leap/base/pluggableconfig.py9
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()