Human meaningful exception message for decoding fields with minimum length.

This commit is contained in:
Jakub Warmuz 2015-07-25 18:17:53 +00:00
parent de3b48640b
commit a55991055e
No known key found for this signature in database
GPG key ID: 2A7BAD3A489B52EA

View file

@ -326,7 +326,8 @@ def decode_b64jose(data, size=None, minimum=False):
if size is not None and ((not minimum and len(decoded) != size)
or (minimum and len(decoded) < size)):
raise errors.DeserializationError()
raise errors.DeserializationError(
"Expected at least or exactly {0} bytes".format(size))
return decoded