|
|
|
@ -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(/(?<name>\w+)\((?<args>.*)\)/); |
|
|
|
|
// Attempt to parse as a custom error
|
|
|
|
|
const match = message.match(/custom error '(?<name>\w+)\((?<args>.*)\)'/); |
|
|
|
|
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; |
|
|
|
|