util/jsoncomm: chain the BufferError in recv

Explicit re-raise the BufferError exception in recv from the orignal
JSONDecodeError, so the latter gets recorded as the underlying cause.

Uncovered by pylint 2.6.0: W0707: "Not using raise from makes the
traceback inaccurate, because the message implies there is a bug in
the exception-handling code itself, which is a separate situation
than wrapping an exception."
This commit is contained in:
Christian Kellner 2020-10-30 16:03:16 +01:00 committed by David Rheinsberg
parent 373f474769
commit cd1f248dca

View file

@ -316,8 +316,8 @@ class Socket(contextlib.AbstractContextManager):
try:
payload = json.loads(msg[0])
except json.JSONDecodeError:
raise BufferError
except json.JSONDecodeError as e:
raise BufferError from e
return (payload, fdset, msg[3])