| 2181 | """ |
| 2182 | |
| 2183 | def __init__(self, hook_name, exc_info, encoded_obj, *args, **kwargs): |
| 2184 | self.hook_name = hook_name |
| 2185 | if not exc_info: |
| 2186 | exc_info = (None, None, None) |
| 2187 | exc_type, self.hook_exception, self.hook_traceback = exc_info |
| 2188 | self.object_type = type(encoded_obj) |
| 2189 | msg = "Hook %s raised %r while decoding type <%s>" % ( |
| 2190 | hook_name, self.hook_exception.__class__.__name__, self.object_type.__name__) |
| 2191 | if len(args) >= 1: |
| 2192 | msg += ": " + args[0] |
| 2193 | args = args[1:] |
| 2194 | super(JSONDecodeHookError, self).__init__(msg, *args, **kwargs) |
| 2195 | |
| 2196 | |
| 2197 | class JSONEncodeError(JSONError): |