mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2026-01-10 00:28:10 -05:00
chore: Add some more context when an exception is caught (#1432)
Co-authored-by: richΛrd <info@richardramos.me>
This commit is contained in:
@@ -110,8 +110,8 @@ proc handleConn(
|
||||
fut2 = sconn.join()
|
||||
try: # https://github.com/status-im/nim-chronos/issues/516
|
||||
discard await race(fut1, fut2)
|
||||
except ValueError:
|
||||
raiseAssert("Futures list is not empty")
|
||||
except ValueError as e:
|
||||
raiseAssert("Futures list is not empty: " & e.msg)
|
||||
# at least one join() completed, cancel pending one, if any
|
||||
if not fut1.finished:
|
||||
await fut1.cancelAndWait()
|
||||
@@ -182,14 +182,14 @@ method readOnce*(
|
||||
except LPStreamEOFError as err:
|
||||
s.isEof = true
|
||||
await s.close()
|
||||
raise err
|
||||
raise newException(LPStreamEOFError, "Secure connection EOF: " & err.msg, err)
|
||||
except CancelledError as exc:
|
||||
raise exc
|
||||
except LPStreamError as err:
|
||||
debug "Error while reading message from secure connection, closing.",
|
||||
error = err.name, message = err.msg, connection = s
|
||||
await s.close()
|
||||
raise err
|
||||
raise newException(LPStreamError, "Secure connection read error: " & err.msg, err)
|
||||
|
||||
var p = cast[ptr UncheckedArray[byte]](pbytes)
|
||||
return s.buf.consumeTo(toOpenArray(p, 0, nbytes - 1))
|
||||
|
||||
Reference in New Issue
Block a user