should not handle transport exceptions

This commit is contained in:
Dmitriy Ryajov 2019-09-25 12:42:52 -06:00
parent 99869aa8b8
commit dd3f85965b
1 changed files with 11 additions and 11 deletions

View File

@ -45,16 +45,16 @@ method readExactly*(s: ChronosStream,
raise newLPStreamReadError(exc.par)
method readLine*(s: ChronosStream, limit = 0, sep = "\r\n"): Future[string] {.async, gcsafe.} =
try:
result = await s.reader.readLine(limit, sep)
except AsyncStreamReadError as exc:
raise newLPStreamReadError(exc.par)
try:
result = await s.reader.readLine(limit, sep)
except AsyncStreamReadError as exc:
raise newLPStreamReadError(exc.par)
method readOnce*(s: ChronosStream, pbytes: pointer, nbytes: int): Future[int] {.async, gcsafe.} =
try:
result = await s.reader.readOnce(pbytes, nbytes)
except AsyncStreamReadError as exc:
raise newLPStreamReadError(exc.par)
try:
result = await s.reader.readOnce(pbytes, nbytes)
except AsyncStreamReadError as exc:
raise newLPStreamReadError(exc.par)
method readUntil*(s: ChronosStream,
pbytes: pointer,
@ -62,9 +62,9 @@ method readUntil*(s: ChronosStream,
sep: seq[byte]): Future[int] {.async, gcsafe.} =
try:
result = await s.reader.readUntil(pbytes, nbytes, sep)
except TransportIncompleteError, AsyncStreamIncompleteError:
except AsyncStreamIncompleteError:
raise newLPStreamIncompleteError()
except TransportLimitError, AsyncStreamLimitError:
except AsyncStreamLimitError:
raise newLPStreamLimitError()
except LPStreamReadError as exc:
raise newLPStreamReadError(exc.par)
@ -106,4 +106,4 @@ method close*(s: ChronosStream) {.async, gcsafe.} =
if not s.client.closed:
await s.client.closeWait()
s.closed = true
s.closed = true