From 171d60fb52e49ca296e6d97dd3f0cbb390d5443b Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Wed, 29 Jan 2020 12:05:05 -0600 Subject: [PATCH] fix: reraise exception in readLp --- libp2p/connection.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libp2p/connection.nim b/libp2p/connection.nim index 70e0b0c..f80631c 100644 --- a/libp2p/connection.nim +++ b/libp2p/connection.nim @@ -130,8 +130,12 @@ proc readLp*(s: Connection): Future[seq[byte]] {.async, gcsafe.} = await s.readExactly(addr result[0], int(size)) except LPStreamIncompleteError as exc: trace "remote connection ended unexpectedly", exc = exc.msg + result.setLen(0) + raise exc except LPStreamReadError as exc: trace "couldn't read from stream", exc = exc.msg + result.setLen(0) + raise exc proc writeLp*(s: Connection, msg: string | seq[byte]): Future[void] {.gcsafe.} = ## write lenght prefixed