undo try blocks; that's not the traceback's source

This commit is contained in:
Ștefan Talpalaru 2020-01-13 19:02:38 +01:00
parent 468e0815b3
commit 7c4d636f83
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 6 additions and 12 deletions

View File

@ -184,12 +184,9 @@ proc sendErrorResponse(peer: Peer,
debug "Received an invalid request",
peer, msgName, msgBytes, errMsg = err.formatMsg("<msg>")
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