mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-20 20:33:17 +00:00
Add StackError and FormatError (#331)
This commit is contained in:
parent
8b6ce53cce
commit
44254dd35e
7 changed files with 120 additions and 48 deletions
|
@ -6,6 +6,7 @@ class UnpackException(Exception):
|
|||
Exception instead.
|
||||
"""
|
||||
|
||||
|
||||
class BufferFull(UnpackException):
|
||||
pass
|
||||
|
||||
|
@ -14,6 +15,14 @@ class OutOfData(UnpackException):
|
|||
pass
|
||||
|
||||
|
||||
class FormatError(ValueError, UnpackException):
|
||||
"""Invalid msgpack format"""
|
||||
|
||||
|
||||
class StackError(ValueError, UnpackException):
|
||||
"""Too nested"""
|
||||
|
||||
|
||||
# Deprecated. Use ValueError instead
|
||||
UnpackValueError = ValueError
|
||||
|
||||
|
@ -24,6 +33,7 @@ class ExtraData(UnpackValueError):
|
|||
This exception is raised while only one-shot (not streaming)
|
||||
unpack.
|
||||
"""
|
||||
|
||||
def __init__(self, unpacked, extra):
|
||||
self.unpacked = unpacked
|
||||
self.extra = extra
|
||||
|
@ -32,7 +42,7 @@ class ExtraData(UnpackValueError):
|
|||
return "unpack(b) received extra data."
|
||||
|
||||
|
||||
#Deprecated. Use Exception instead to catch all exception during packing.
|
||||
# Deprecated. Use Exception instead to catch all exception during packing.
|
||||
PackException = Exception
|
||||
PackValueError = ValueError
|
||||
PackOverflowError = OverflowError
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue