From 1bd933cd5aad979d9d85f200ed783247e757d1a7 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Tue, 4 Feb 2020 17:27:32 +0100 Subject: [PATCH] More precise tracing --- libp2p/multistream.nim | 2 +- libp2p/protocols/pubsub/pubsubpeer.nim | 4 ++-- libp2p/protocols/secure/secio.nim | 2 +- libp2p/switch.nim | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libp2p/multistream.nim b/libp2p/multistream.nim index fd1260db1..061d3be84 100644 --- a/libp2p/multistream.nim +++ b/libp2p/multistream.nim @@ -148,7 +148,7 @@ proc handle*(m: MultisteamSelect, conn: Connection) {.async, gcsafe.} = warn "no handlers for ", protocol = ms await conn.write(m.na) except CatchableError as exc: - trace "exception occured", exc = exc.msg + trace "exception occurred in MultistreamSelect.handle", exc = exc.msg finally: trace "leaving multistream loop" diff --git a/libp2p/protocols/pubsub/pubsubpeer.nim b/libp2p/protocols/pubsub/pubsubpeer.nim index 14851d6c5..4988e7aed 100644 --- a/libp2p/protocols/pubsub/pubsubpeer.nim +++ b/libp2p/protocols/pubsub/pubsubpeer.nim @@ -62,7 +62,7 @@ proc handle*(p: PubSubPeer, conn: Connection) {.async.} = await p.handler(p, @[msg]) p.recvdRpcCache.put($hexData.hash) except CatchableError as exc: - error "exception occured", exc = exc.msg + error "exception occurred in PubSubPeer.handle", exc = exc.msg finally: trace "exiting pubsub peer read loop", peer = p.id if not conn.closed(): @@ -100,7 +100,7 @@ proc send*(p: PubSubPeer, msgs: seq[RPCMsg]) {.async.} = encoded = encodedHex except CatchableError as exc: - trace "exception occured", exc = exc.msg + trace "exception occurred in PubSubPeer.send", exc = exc.msg proc sendMsg*(p: PubSubPeer, peerId: PeerID, diff --git a/libp2p/protocols/secure/secio.nim b/libp2p/protocols/secure/secio.nim index ac3970ed4..0d92bff08 100644 --- a/libp2p/protocols/secure/secio.nim +++ b/libp2p/protocols/secure/secio.nim @@ -426,7 +426,7 @@ proc readLoop(sconn: SecureConnection, stream: BufferStream) {.async.} = await stream.pushTo(msg) except CatchableError as exc: - trace "exception occured", exc = exc.msg + trace "exception occurred SecureConnection.readLoop", exc = exc.msg finally: if not sconn.closed: await sconn.close() diff --git a/libp2p/switch.nim b/libp2p/switch.nim index f8837b740..44ba0d53c 100644 --- a/libp2p/switch.nim +++ b/libp2p/switch.nim @@ -258,7 +258,7 @@ proc start*(s: Switch): Future[seq[Future[void]]] {.async, gcsafe.} = try: await s.upgradeIncoming(conn) # perform upgrade on incoming connection except CatchableError as exc: - trace "exception occured", exc = exc.msg + trace "exception occurred in Switch.start", exc = exc.msg finally: if not isNil(conn) and not conn.closed: await conn.close()