mirror of https://github.com/vacp2p/nim-libp2p.git
should not handle transport exceptions
This commit is contained in:
parent
99869aa8b8
commit
dd3f85965b
|
@ -45,16 +45,16 @@ method readExactly*(s: ChronosStream,
|
||||||
raise newLPStreamReadError(exc.par)
|
raise newLPStreamReadError(exc.par)
|
||||||
|
|
||||||
method readLine*(s: ChronosStream, limit = 0, sep = "\r\n"): Future[string] {.async, gcsafe.} =
|
method readLine*(s: ChronosStream, limit = 0, sep = "\r\n"): Future[string] {.async, gcsafe.} =
|
||||||
try:
|
try:
|
||||||
result = await s.reader.readLine(limit, sep)
|
result = await s.reader.readLine(limit, sep)
|
||||||
except AsyncStreamReadError as exc:
|
except AsyncStreamReadError as exc:
|
||||||
raise newLPStreamReadError(exc.par)
|
raise newLPStreamReadError(exc.par)
|
||||||
|
|
||||||
method readOnce*(s: ChronosStream, pbytes: pointer, nbytes: int): Future[int] {.async, gcsafe.} =
|
method readOnce*(s: ChronosStream, pbytes: pointer, nbytes: int): Future[int] {.async, gcsafe.} =
|
||||||
try:
|
try:
|
||||||
result = await s.reader.readOnce(pbytes, nbytes)
|
result = await s.reader.readOnce(pbytes, nbytes)
|
||||||
except AsyncStreamReadError as exc:
|
except AsyncStreamReadError as exc:
|
||||||
raise newLPStreamReadError(exc.par)
|
raise newLPStreamReadError(exc.par)
|
||||||
|
|
||||||
method readUntil*(s: ChronosStream,
|
method readUntil*(s: ChronosStream,
|
||||||
pbytes: pointer,
|
pbytes: pointer,
|
||||||
|
@ -62,9 +62,9 @@ method readUntil*(s: ChronosStream,
|
||||||
sep: seq[byte]): Future[int] {.async, gcsafe.} =
|
sep: seq[byte]): Future[int] {.async, gcsafe.} =
|
||||||
try:
|
try:
|
||||||
result = await s.reader.readUntil(pbytes, nbytes, sep)
|
result = await s.reader.readUntil(pbytes, nbytes, sep)
|
||||||
except TransportIncompleteError, AsyncStreamIncompleteError:
|
except AsyncStreamIncompleteError:
|
||||||
raise newLPStreamIncompleteError()
|
raise newLPStreamIncompleteError()
|
||||||
except TransportLimitError, AsyncStreamLimitError:
|
except AsyncStreamLimitError:
|
||||||
raise newLPStreamLimitError()
|
raise newLPStreamLimitError()
|
||||||
except LPStreamReadError as exc:
|
except LPStreamReadError as exc:
|
||||||
raise newLPStreamReadError(exc.par)
|
raise newLPStreamReadError(exc.par)
|
||||||
|
|
Loading…
Reference in New Issue