Skip to content

[Question] Error format depending on the EVM backend ?Β #42

@challet

Description

@challet

Hello, while using Ganache as a development backend, some errors are not handled as expected.
For instance with the following one (the context is a call to ethers estimateGas method which makes a dry run of the transaction and so can throw similar errors as the actual transaction):

{
	"code": -32603,
	"data": {
		"code": -32000,
		"data": {
			"hash": null,
			"message": "revert",
			"programCounter": 1420,
			"reason": "[revert message]",
			"result": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c34303920436f6e666c6963740000000000000000000000000000000000000000"
		},
		"message": "VM Exception while processing transaction: revert [revert message]",
		"name": "RuntimeError",
		"stack": "RuntimeError: VM Exception while processing transaction: revert [revert message]\n    at exactimate ([path]/node_modules/ganache/dist/node/1.js:2:182333)"
	},
	"message": "Internal JSON-RPC error."
}

It is parsed as { errorCode: 'UNKNOWN_ERROR', context: '-32603' } while imho it should return the EXECUTION_REVERTED one :

EXECUTION_REVERTED: "EXECUTION_REVERTED",

The text message looks really specific to Ganache and I'm wondering whether the whole error structure is also specific to it. How could it be then handled by the error parser ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions