From 7d2d46effce37f9fbf394fac74d380aaa7c95f02 Mon Sep 17 00:00:00 2001 From: palaviv Date: Fri, 12 Feb 2016 11:00:39 +0200 Subject: msgpack pack and unpack throws only exception that inherit from MsgpackBaseException. cython and fallback throws same exceptions --- msgpack/exceptions.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'msgpack/exceptions.py') diff --git a/msgpack/exceptions.py b/msgpack/exceptions.py index f7678f1..e0d5b5f 100644 --- a/msgpack/exceptions.py +++ b/msgpack/exceptions.py @@ -1,4 +1,8 @@ -class UnpackException(Exception): +class MsgpackBaseException(Exception): + pass + + +class UnpackException(MsgpackBaseException): pass @@ -22,8 +26,12 @@ class ExtraData(ValueError): def __str__(self): return "unpack(b) received extra data." -class PackException(Exception): +class PackException(MsgpackBaseException): pass class PackValueError(PackException, ValueError): pass + + +class PackOverflowError(PackValueError, OverflowError): + pass -- cgit v1.2.1 From e15085db0362899520f714e3959c37721c839cef Mon Sep 17 00:00:00 2001 From: palaviv Date: Fri, 12 Feb 2016 15:39:50 +0200 Subject: removed MsgpackBaseException --- msgpack/exceptions.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'msgpack/exceptions.py') diff --git a/msgpack/exceptions.py b/msgpack/exceptions.py index e0d5b5f..e982079 100644 --- a/msgpack/exceptions.py +++ b/msgpack/exceptions.py @@ -1,8 +1,4 @@ -class MsgpackBaseException(Exception): - pass - - -class UnpackException(MsgpackBaseException): +class UnpackException(Exception): pass @@ -26,9 +22,11 @@ class ExtraData(ValueError): def __str__(self): return "unpack(b) received extra data." -class PackException(MsgpackBaseException): + +class PackException(Exception): pass + class PackValueError(PackException, ValueError): pass -- cgit v1.2.1 From d90008d4f57ec83a15b84cf2db2edc36e9504ac1 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Sun, 14 Feb 2016 11:46:28 +0900 Subject: ExtraData should be UnpackValueError --- msgpack/exceptions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'msgpack/exceptions.py') diff --git a/msgpack/exceptions.py b/msgpack/exceptions.py index e982079..bb12264 100644 --- a/msgpack/exceptions.py +++ b/msgpack/exceptions.py @@ -14,7 +14,7 @@ class UnpackValueError(UnpackException, ValueError): pass -class ExtraData(ValueError): +class ExtraData(UnpackValueError): def __init__(self, unpacked, extra): self.unpacked = unpacked self.extra = extra -- cgit v1.2.1 From 3dad39811d93a58c5d3de874193290b935da1446 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Sun, 14 Feb 2016 11:54:01 +0900 Subject: Deprecate PackExceptions --- msgpack/exceptions.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'msgpack/exceptions.py') diff --git a/msgpack/exceptions.py b/msgpack/exceptions.py index bb12264..73010b7 100644 --- a/msgpack/exceptions.py +++ b/msgpack/exceptions.py @@ -24,12 +24,18 @@ class ExtraData(UnpackValueError): class PackException(Exception): - pass + """Deprecated. Use Exception instead to catch all exception during packing.""" class PackValueError(PackException, ValueError): - pass + """PackValueError is raised when type of input data is supported but it's value is unsupported. + + Deprecated. Use ValueError instead. + """ class PackOverflowError(PackValueError, OverflowError): - pass + """PackOverflowError is raised when integer value is out of range of msgpack support [-2**31, 2**32). + + Deprecated. Use ValueError instead. + """ -- cgit v1.2.1 From b2a8ce6cbdbef80d1a89d02fa483f56862cf1efa Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Sun, 14 Feb 2016 14:32:11 +0900 Subject: Deprecate more useless exceptions --- msgpack/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'msgpack/exceptions.py') diff --git a/msgpack/exceptions.py b/msgpack/exceptions.py index 73010b7..9766881 100644 --- a/msgpack/exceptions.py +++ b/msgpack/exceptions.py @@ -1,5 +1,5 @@ class UnpackException(Exception): - pass + """Deprecated. Use Exception instead to catch all exception during unpacking.""" class BufferFull(UnpackException): @@ -11,7 +11,7 @@ class OutOfData(UnpackException): class UnpackValueError(UnpackException, ValueError): - pass + """Deprecated. Use ValueError instead.""" class ExtraData(UnpackValueError): -- cgit v1.2.1