Replace getCurrentException

This commit is contained in:
kdeme 2019-12-04 13:36:16 +01:00
parent 5aa52854fe
commit 9964a55772
3 changed files with 9 additions and 14 deletions

View File

@ -183,10 +183,8 @@ proc process*() =
while nimbus.state == Running: while nimbus.state == Running:
try: try:
poll() poll()
except CatchableError: except CatchableError as e:
debug "Exception in poll()", debug "Exception in poll()", exc = e.name, err = e.msg
exc = getCurrentException().name,
err = getCurrentExceptionMsg()
# Stop loop # Stop loop
waitFor stop() waitFor stop()

View File

@ -347,9 +347,8 @@ proc executeOpcodes(computation: BaseComputation) =
try: try:
computation.selectVM(fork) computation.selectVM(fork)
except: except CatchableError as e:
let msg = getCurrentExceptionMsg() computation.setError(&"Opcode Dispatch Error msg={e.msg}, depth={computation.msg.depth}", true)
computation.setError(&"Opcode Dispatch Error msg={msg}, depth={computation.msg.depth}", true)
computation.nextProc() computation.nextProc()
if computation.isError(): if computation.isError():

View File

@ -358,14 +358,12 @@ proc execPrecompiles*(computation: BaseComputation, fork: Fork): bool {.inline.}
of paEcMul: bn256ecMul(computation, fork) of paEcMul: bn256ecMul(computation, fork)
of paPairing: bn256ecPairing(computation, fork) of paPairing: bn256ecPairing(computation, fork)
of paBlake2bf: blake2bf(computation) of paBlake2bf: blake2bf(computation)
except OutOfGas: except OutOfGas as e:
let msg = getCurrentExceptionMsg()
# cannot use setError here, cyclic dependency # cannot use setError here, cyclic dependency
computation.error = Error(info: msg, burnsGas: true) computation.error = Error(info: e.msg, burnsGas: true)
except CatchableError: except CatchableError as e:
let msg = getCurrentExceptionMsg()
if fork >= FKByzantium and precompile > paIdentity: if fork >= FKByzantium and precompile > paIdentity:
computation.error = Error(info: msg, burnsGas: true) computation.error = Error(info: e.msg, burnsGas: true)
else: else:
# swallow any other precompiles errors # swallow any other precompiles errors
debug "execPrecompiles validation error", msg=msg debug "execPrecompiles validation error", msg=e.msg