diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2018-11-20 13:12:49 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-20 13:12:49 +0900 |
commit | 44254dd35e8aa3cfd6706e14effab117d7f22c25 (patch) | |
tree | 2bdf0ba6f5e4a0edc7233bef0dba04df3fa7ddbf /msgpack/exceptions.py | |
parent | 8b6ce53cce40e528af7cce89f358f7dde1a09289 (diff) | |
download | msgpack-python-44254dd35e8aa3cfd6706e14effab117d7f22c25.tar.gz |
Add StackError and FormatError (#331)
Diffstat (limited to 'msgpack/exceptions.py')
-rw-r--r-- | msgpack/exceptions.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/msgpack/exceptions.py b/msgpack/exceptions.py index 5bee5b2..d6d2615 100644 --- a/msgpack/exceptions.py +++ b/msgpack/exceptions.py @@ -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 |