diff --git a/test/helpers/customError.js b/test/helpers/customError.js index e38170b78..ea5c36820 100644 --- a/test/helpers/customError.js +++ b/test/helpers/customError.js @@ -13,13 +13,10 @@ async function expectRevertCustomError(promise, expectedErrorName, args) { // VM Exception while processing transaction: // reverted with custom error 'InvalidAccountNonce("0x70997970C51812dc3A010C7d01b50e0d17dc79C8", 0)' - // We trim out anything inside the single quotes as comma-separated values - const [, error] = message.match(/'(.*)'/); - - // Attempt to parse as an error - const match = error.match(/(?\w+)\((?.*)\)/); + // Attempt to parse as a custom error + const match = message.match(/custom error '(?\w+)\((?.*)\)'/); if (!match) { - expect.fail(`Couldn't parse "${error}" as a custom error`); + expect.fail(`Could not parse as custom error. ${message}`); } // Extract the error name and parameters const errorName = match.groups.name;