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
|
|
|
|
|
|
|
|
|
|
|
|
class ExtraData(ValueError):
|
|
|
|
def __init__(self, unpacked, extra):
|
|
|
|
self.unpacked = unpacked
|
|
|
|
self.extra = extra
|
|
|
|
|
|
|
|
def __str__(self):
|
2013-09-13 13:47:13 +02:00
|
|
|
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):
|
2012-12-11 22:15:21 +09:00
|
|
|
pass
|
|
|
|
|
2016-02-12 15:39:50 +02:00
|
|
|
|
2012-12-11 22:15:21 +09:00
|
|
|
class PackValueError(PackException, ValueError):
|
|
|
|
pass
|
2016-02-12 11:00:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
class PackOverflowError(PackValueError, OverflowError):
|
|
|
|
pass
|