Add more diagnostic for crashes during SSZ serialization

This commit is contained in:
Zahary Karadjov 2019-09-10 19:45:08 -04:00
parent 2bbe2cb23c
commit b5fad0c9e8
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 8 additions and 0 deletions

View File

@ -608,6 +608,14 @@ proc p2pProtocolBackendImpl*(p: P2PProtocol): Backend =
`await` sendErrorResponse(`peerVar`, `streamVar`, `errVar`,
`msgNameLit`, `msgBytesVar`)
return
except Exception as err:
# TODO. This is temporary code that should be removed after interop.
# It can be enabled only in certain diagnostic builds where it should
# re-raise the exception.
debug "Crash during serialization", inputBytes = toHex(`msgBytesVar`),
msgName = `msgNameLit`,
deserializedType = astToStr(`msgRecName`)
`await` sendErrorResponse(`peerVar`, `streamVar`, ServerError, err.msg)
try:
`tracing`