diff --git a/beacon_chain/libp2p_backends_common.nim b/beacon_chain/libp2p_backends_common.nim index d8474dab8..6c2cdf14c 100644 --- a/beacon_chain/libp2p_backends_common.nim +++ b/beacon_chain/libp2p_backends_common.nim @@ -184,12 +184,9 @@ proc sendErrorResponse(peer: Peer, debug "Received an invalid request", peer, msgName, msgBytes, errMsg = err.formatMsg("") - try: - let responseBytes = encodeErrorMsg(InvalidRequest, err.formatMsg("msg")) - await stream.writeAllBytes(responseBytes) - await stream.close() - except Exception as err: - debug "Error during sendErrorResponse()", error = err.msg + let responseBytes = encodeErrorMsg(InvalidRequest, err.formatMsg("msg")) + await stream.writeAllBytes(responseBytes) + await stream.close() proc sendErrorResponse(peer: Peer, stream: P2PStream, @@ -197,12 +194,9 @@ proc sendErrorResponse(peer: Peer, errMsg: string) {.async.} = debug "Error processing request", peer, responseCode, errMsg - try: - let responseBytes = encodeErrorMsg(ServerError, errMsg) - await stream.writeAllBytes(responseBytes) - await stream.close() - except Exception as err: - debug "Error during sendErrorResponse()", error = err.msg + let responseBytes = encodeErrorMsg(ServerError, errMsg) + await stream.writeAllBytes(responseBytes) + await stream.close() proc sendNotificationMsg(peer: Peer, protocolId: string, requestBytes: Bytes) {.async} = var deadline = sleepAsync RESP_TIMEOUT