Less verbosity about some errors

This commit is contained in:
Yuriy Glukhov 2018-09-06 19:52:13 +03:00 committed by zah
parent 9392ae1d53
commit 892467b5a8
1 changed files with 14 additions and 6 deletions

View File

@ -509,10 +509,12 @@ proc checkedRlpRead(r: var Rlp, MsgType: type): auto {.inline.} =
try: try:
return r.read(MsgType) return r.read(MsgType)
except: except:
# echo "Failed rlp.read:", tmp.inspect
error "Failed rlp.read", error "Failed rlp.read",
msg = MsgType.name, msg = MsgType.name,
# dataHex = r.rawData.toSeq().toHex(), exception = getCurrentExceptionMsg()
data = tmp.inspect # dataHex = r.rawData.toSeq().toHex()
raise raise
proc waitSingleMsg*(peer: Peer, MsgType: type): Future[MsgType] {.async.} = proc waitSingleMsg*(peer: Peer, MsgType: type): Future[MsgType] {.async.} =
@ -1168,12 +1170,18 @@ proc rlpxConnect*(node: EthereumNode, remote: Node): Future[Peer] {.async.} =
except UnexpectedDisconnectError as e: except UnexpectedDisconnectError as e:
if e.reason != TooManyPeers: if e.reason != TooManyPeers:
debug "Unexpected disconnect during rlpxConnect", reason = e.reason debug "Unexpected disconnect during rlpxConnect", reason = e.reason
except TransportIncompleteError:
debug "Connection dropped in rlpxConnect", remote
except UselessPeerError: except UselessPeerError:
debug "Useless peer" debug "Useless peer"
except RlpTypeMismatch:
# Some peers report capabilities with names longer than 3 chars. We ignore
# those for now. Maybe we should allow this though.
debug "Rlp error in rlpxConnect"
except: except:
error "Exception in rlpxConnect", info "Exception in rlpxConnect", remote,
err = getCurrentExceptionMsg(), exc = getCurrentException().name,
stackTrace = getCurrentException().getStackTrace() err = getCurrentExceptionMsg()
if not ok: if not ok:
if not isNil(result.transp): if not isNil(result.transp):
@ -1378,7 +1386,7 @@ proc maybeConnectToMorePeers(p: PeerPool) {.async.} =
if p.lastLookupTime + lookupInterval < epochTime(): if p.lastLookupTime + lookupInterval < epochTime():
ensureFuture p.lookupRandomNode() ensureFuture p.lookupRandomNode()
# await p.connectToNode(newNode("enode://dd9a58df98decc85fdfaa111c8a8581eb20410e828317cff91af4b87f98f6223ffbb1e657ee84ea6791ef2ac50176a88852cda84d7db1e04b65f3792729ec7d3@127.0.0.1:30303")) # await p.connectToNode(newNode("enode://a52e914fa5aa46409e526a342a1e68b4e572c720e6eb1e61ad4a4201937679e7ebd26915bdabb2fdab6add7d85ba537078dbdccca89816a40ffc375572b6f73d@127.0.0.1:30303"))
await p.connectToNodes(p.nodesToConnect()) await p.connectToNodes(p.nodesToConnect())
# In some cases (e.g ROPSTEN or private testnets), the discovery table might # In some cases (e.g ROPSTEN or private testnets), the discovery table might