Remove unnecessary error check

This commit is contained in:
Mark Spanbroek 2022-09-20 15:36:42 +02:00 committed by markspanbroek
parent 7d2acd65e8
commit e8592bb922
1 changed files with 12 additions and 16 deletions

View File

@ -1,23 +1,19 @@
import std/strutils import std/strutils
import std/json
import ./provider import ./provider
proc revertReason*(e: ref ProviderError): string = proc revertReason*(e: ref ProviderError): string =
try: var msg = e.msg
var msg = e.msg const revertPrefixes = @[
const revertPrefixes = @[ # hardhat
# hardhat "Error: VM Exception while processing transaction: reverted with " &
"Error: VM Exception while processing transaction: reverted with " & "reason string ",
"reason string ", # ganache
# ganache "VM Exception while processing transaction: revert "
"VM Exception while processing transaction: revert " ]
] for prefix in revertPrefixes.items:
for prefix in revertPrefixes.items: msg = msg.replace(prefix)
msg = msg.replace(prefix) msg = msg.replace("\'")
msg = msg.replace("\'") return msg
return msg
except JsonParsingError:
return ""
proc reverts*[T](call: Future[T]): Future[bool] {.async.} = proc reverts*[T](call: Future[T]): Future[bool] {.async.} =
try: try: