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:
parent
373f474769
commit
cd1f248dca
1 changed files with 2 additions and 2 deletions
|
|
@ -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])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue