msgpack-python/msgpack/exceptions.py

42 lines
941 B
Python
Raw Normal View History

2016-02-12 15:39:50 +02:00
class UnpackException(Exception):
2012-12-10 00:31:19 +09:00
pass
class BufferFull(UnpackException):
pass
class OutOfData(UnpackException):
pass
class UnpackValueError(UnpackException, ValueError):
pass
2016-02-14 11:46:28 +09:00
class ExtraData(UnpackValueError):
2012-12-10 00:31:19 +09:00
def __init__(self, unpacked, extra):
self.unpacked = unpacked
self.extra = extra
def __str__(self):
return "unpack(b) received extra data."
2012-12-11 22:15:21 +09:00
2016-02-12 15:39:50 +02:00
class PackException(Exception):
2016-02-14 11:54:01 +09:00
"""Deprecated. Use Exception instead to catch all exception during packing."""
2012-12-11 22:15:21 +09:00
2016-02-12 15:39:50 +02:00
2012-12-11 22:15:21 +09:00
class PackValueError(PackException, ValueError):
2016-02-14 11:54:01 +09:00
"""PackValueError is raised when type of input data is supported but it's value is unsupported.
Deprecated. Use ValueError instead.
"""
class PackOverflowError(PackValueError, OverflowError):
2016-02-14 11:54:01 +09:00
"""PackOverflowError is raised when integer value is out of range of msgpack support [-2**31, 2**32).
Deprecated. Use ValueError instead.
"""