From e8592bb92219f5fcec25af22bed474a4f95c0a54 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Tue, 20 Sep 2022 15:36:42 +0200 Subject: [PATCH] Remove unnecessary error check --- ethers/testing.nim | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/ethers/testing.nim b/ethers/testing.nim index e3ea24b..5d38c1f 100644 --- a/ethers/testing.nim +++ b/ethers/testing.nim @@ -1,23 +1,19 @@ import std/strutils -import std/json import ./provider proc revertReason*(e: ref ProviderError): string = - try: - var msg = e.msg - const revertPrefixes = @[ - # hardhat - "Error: VM Exception while processing transaction: reverted with " & - "reason string ", - # ganache - "VM Exception while processing transaction: revert " - ] - for prefix in revertPrefixes.items: - msg = msg.replace(prefix) - msg = msg.replace("\'") - return msg - except JsonParsingError: - return "" + var msg = e.msg + const revertPrefixes = @[ + # hardhat + "Error: VM Exception while processing transaction: reverted with " & + "reason string ", + # ganache + "VM Exception while processing transaction: revert " + ] + for prefix in revertPrefixes.items: + msg = msg.replace(prefix) + msg = msg.replace("\'") + return msg proc reverts*[T](call: Future[T]): Future[bool] {.async.} = try: