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:
try:
poll()
except CatchableError:
debug "Exception in poll()",
exc = getCurrentException().name,
err = getCurrentExceptionMsg()
except CatchableError as e:
debug "Exception in poll()", exc = e.name, err = e.msg
# Stop loop
waitFor stop()

View File

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

View File

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