Skip to content

Commit 805ae6f

Browse files
authored
fix: Handle a special case of BrokenPipeError exception (#573)
send_data catches any exception and calls report_server_error method that tries to notify client. But the connection to the client is lost
1 parent a204d0d commit 805ae6f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pygls/protocol/json_rpc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ def _send_data(self, data: Any):
542542
if inspect.isawaitable(res):
543543
asyncio.ensure_future(res)
544544

545+
except BrokenPipeError:
546+
logger.exception("Error sending data. BrokenPipeError", exc_info=True)
547+
raise
545548
except Exception as error:
546549
logger.exception("Error sending data", exc_info=True)
547550
self._server._report_server_error(error, JsonRpcInternalError)

0 commit comments

Comments
 (0)