diff options
author | Ben Smithers <ben.smithers@bristol.ac.uk> | 2017-12-11 14:38:42 +0000 |
---|---|---|
committer | Ben Smithers <ben.smithers@bristol.ac.uk> | 2017-12-11 14:47:45 +0000 |
commit | c202c48295b63b526f822efcbaf94a6dbf64b8a3 (patch) | |
tree | 0f73bfe7956711441db27e84a23b427f749f8da9 /jsonschema/exceptions.py | |
parent | 30bec1a0100d8d8788eef2eb723fab9f60a7d769 (diff) | |
download | jsonschema-c202c48295b63b526f822efcbaf94a6dbf64b8a3.tar.gz |
Minor changes addressing PR review issues
Diffstat (limited to 'jsonschema/exceptions.py')
-rw-r--r-- | jsonschema/exceptions.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/jsonschema/exceptions.py b/jsonschema/exceptions.py index c6ef8c1..d10f246 100644 --- a/jsonschema/exceptions.py +++ b/jsonschema/exceptions.py @@ -141,7 +141,18 @@ class RefResolutionError(Exception): class UndefinedTypeCheck(Exception): - pass + def __init__(self, type): + self.type = type + + def __unicode__(self): + return "Type %r is unknown to this type checker" % self.type + + if PY3: + __str__ = __unicode__ + else: + def __str__(self): + return unicode(self).encode("utf-8") + class UnknownType(Exception): def __init__(self, type, instance, schema): |