summaryrefslogtreecommitdiff
path: root/msgpack/fallback.py
diff options
context:
space:
mode:
authorINADA Naoki <songofacandy@gmail.com>2014-02-13 01:19:33 +0900
committerINADA Naoki <songofacandy@gmail.com>2014-02-13 01:19:33 +0900
commitf322ed4e1bc3b9243b187df31af1f2d72876b9b6 (patch)
treece030b07f18c8c09a5aaa354be7a172ac183f3a3 /msgpack/fallback.py
parent7973cce554b94f4418c258fb723820ae5fffdd26 (diff)
parent77046b839da20feb528d303c8858ab6f34013ce7 (diff)
downloadmsgpack-python-f322ed4e1bc3b9243b187df31af1f2d72876b9b6.tar.gz
Merge pull request #84 from wbolster/exception-type-cleanups
Always raise TypeError for wrong argument types
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r--msgpack/fallback.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/msgpack/fallback.py b/msgpack/fallback.py
index bf5b1c2..cf61023 100644
--- a/msgpack/fallback.py
+++ b/msgpack/fallback.py
@@ -159,7 +159,7 @@ class Unpacker(object):
self._fb_feeding = True
else:
if not callable(file_like.read):
- raise ValueError("`file_like.read` must be callable")
+ raise TypeError("`file_like.read` must be callable")
self.file_like = file_like
self._fb_feeding = False
self._fb_buffers = []
@@ -179,16 +179,16 @@ class Unpacker(object):
self._ext_hook = ext_hook
if list_hook is not None and not callable(list_hook):
- raise ValueError('`list_hook` is not callable')
+ raise TypeError('`list_hook` is not callable')
if object_hook is not None and not callable(object_hook):
- raise ValueError('`object_hook` is not callable')
+ raise TypeError('`object_hook` is not callable')
if object_pairs_hook is not None and not callable(object_pairs_hook):
- raise ValueError('`object_pairs_hook` is not callable')
+ raise TypeError('`object_pairs_hook` is not callable')
if object_hook is not None and object_pairs_hook is not None:
- raise ValueError("object_pairs_hook and object_hook are mutually "
- "exclusive")
+ raise TypeError("object_pairs_hook and object_hook are mutually "
+ "exclusive")
if not callable(ext_hook):
- raise ValueError("`ext_hook` is not callable")
+ raise TypeError("`ext_hook` is not callable")
def feed(self, next_bytes):
if isinstance(next_bytes, array.array):