Merge pull request #60 from status-im/nogetcurexcp

Remove usage of getCurrentException().
This commit is contained in:
Eugene Kabanov 2019-11-28 20:46:23 +02:00 committed by GitHub
commit cb44a30430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 28 deletions

View File

@ -1,5 +1,5 @@
packageName = "chronos"
version = "2.3.3"
version = "2.3.4"
author = "Status Research & Development GmbH"
description = "Chronos"
license = "Apache License 2.0 or MIT"

View File

@ -52,15 +52,15 @@ template createCb(retFutureSym, iteratorNameSym,
{.pop.}
except CancelledError:
retFutureSym.cancel()
except:
except CatchableError as exc:
futureVarCompletions
if retFutureSym.finished():
# Take a look at tasyncexceptions for the bug which this fixes.
# That test explains it better than I can here.
raise
raise exc
else:
retFutureSym.fail(getCurrentException())
retFutureSym.fail(exc)
identName()
{.pop.}

View File

@ -299,8 +299,8 @@ proc readExactly*(rstream: AsyncStreamReader, pbytes: pointer,
raise
except TransportIncompleteError:
raise newAsyncStreamIncompleteError()
except:
raise newAsyncStreamReadError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamReadError(exc)
else:
if isNil(rstream.readerLoop):
await readExactly(rstream.rsource, pbytes, nbytes)
@ -337,8 +337,8 @@ proc readOnce*(rstream: AsyncStreamReader, pbytes: pointer,
result = await readOnce(rstream.tsource, pbytes, nbytes)
except CancelledError:
raise
except:
raise newAsyncStreamReadError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamReadError(exc)
else:
if isNil(rstream.readerLoop):
result = await readOnce(rstream.rsource, pbytes, nbytes)
@ -386,8 +386,8 @@ proc readUntil*(rstream: AsyncStreamReader, pbytes: pointer, nbytes: int,
raise newAsyncStreamIncompleteError()
except TransportLimitError:
raise newAsyncStreamLimitError()
except:
raise newAsyncStreamReadError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamReadError(exc)
else:
if isNil(rstream.readerLoop):
result = await readUntil(rstream.rsource, pbytes, nbytes, sep)
@ -449,8 +449,8 @@ proc readLine*(rstream: AsyncStreamReader, limit = 0,
result = await readLine(rstream.tsource, limit, sep)
except CancelledError:
raise
except:
raise newAsyncStreamReadError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamReadError(exc)
else:
if isNil(rstream.readerLoop):
result = await readLine(rstream.rsource, limit, sep)
@ -504,8 +504,8 @@ proc read*(rstream: AsyncStreamReader, n = 0): Future[seq[byte]] {.async.} =
result = await read(rstream.tsource, n)
except CancelledError:
raise
except:
raise newAsyncStreamReadError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamReadError(exc)
else:
if isNil(rstream.readerLoop):
result = await read(rstream.rsource, n)
@ -556,8 +556,8 @@ proc consume*(rstream: AsyncStreamReader, n = -1): Future[int] {.async.} =
raise
except TransportLimitError:
raise newAsyncStreamLimitError()
except:
raise newAsyncStreamReadError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamReadError(exc)
else:
if isNil(rstream.readerLoop):
result = await consume(rstream.rsource, n)
@ -608,8 +608,8 @@ proc write*(wstream: AsyncStreamWriter, pbytes: pointer,
res = await write(wstream.tsource, pbytes, nbytes)
except CancelledError:
raise
except:
raise newAsyncStreamWriteError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamWriteError(exc)
if res != nbytes:
raise newAsyncStreamIncompleteError()
else:
@ -651,8 +651,8 @@ proc write*(wstream: AsyncStreamWriter, sbytes: seq[byte],
res = await write(wstream.tsource, sbytes, msglen)
except CancelledError:
raise
except:
raise newAsyncStreamWriteError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamWriteError(exc)
if res != length:
raise newAsyncStreamIncompleteError()
else:
@ -696,8 +696,8 @@ proc write*(wstream: AsyncStreamWriter, sbytes: string,
res = await write(wstream.tsource, sbytes, msglen)
except CancelledError:
raise
except:
raise newAsyncStreamWriteError(getCurrentException())
except CatchableError as exc:
raise newAsyncStreamWriteError(exc)
if res != length:
raise newAsyncStreamIncompleteError()
else:

View File

@ -260,8 +260,8 @@ proc tlsReadLoop(stream: AsyncStreamReader) {.async.} =
except CancelledError:
rstream.state = AsyncStreamState.Stopped
except AsyncStreamReadError:
rstream.error = getCurrentException()
except AsyncStreamReadError as exc:
rstream.error = exc
rstream.state = AsyncStreamState.Error
if not(rstream.handshaked):
rstream.handshaked = true

View File

@ -219,8 +219,8 @@ proc initTAddress*(address: string): TransportAddress =
else:
raise newException(TransportAddressError, "Incorrect address family!")
result.port = Port(port)
except:
raise newException(TransportAddressError, getCurrentException().msg)
except CatchableError as exc:
raise newException(TransportAddressError, exc.msg)
else:
result = TransportAddress(family: AddressFamily.Unix)
@ -237,8 +237,8 @@ proc initTAddress*(address: string, port: Port): TransportAddress =
result.address_v6 = ipaddr.address_v6
else:
raise newException(TransportAddressError, "Incorrect address family!")
except:
raise newException(TransportAddressError, getCurrentException().msg)
except CatchableError as exc:
raise newException(TransportAddressError, exc.msg)
proc initTAddress*(address: string, port: int): TransportAddress {.inline.} =
## Initialize ``TransportAddress`` with IP (IPv4 or IPv6) address ``address``