From 2da59a86c3f5ef4dc886e41b5c75694bde0ce3c8 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Wed, 15 May 2024 13:36:56 +0200 Subject: [PATCH] improve decoding failure messages Co-Authored-By: Eric Mastro --- ethers/errors/encoding.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ethers/errors/encoding.nim b/ethers/errors/encoding.nim index 72372eb..fda37d9 100644 --- a/ethers/errors/encoding.nim +++ b/ethers/errors/encoding.nim @@ -21,12 +21,12 @@ func decode*[E: SolidityError](_: type E, data: seq[byte]): ?!(ref E) = return failure "unable to decode " & $E & ": selector doesn't match" when compiles(E.arguments): without arguments =? E.decodeArguments(data), error: - return failure "unable to decode " & $E & ": " & error.msg + return failure "unable to decode arguments of " & $E & ": " & error.msg let message = "EVM reverted: " & $E & $arguments success (ref E)(msg: message, arguments: arguments) else: if data.len > 4: - return failure "unable to decode " & $E & ": unread trailing bytes found" + return failure "unable to decode: " & $E & ".arguments is not defined" let message = "EVM reverted: " & $E & "()" success (ref E)(msg: message)