Description
Ethers Version
6.6.3
Search Terms
error message handling
Describe the Problem
In the ethers documentation, it's stated that:
"All errors in ethers include properties to ensure they are both human-readable (i.e. .message) and machine-readable (i.e. .code)."
However, I'm finding the actual error.message field is less than ideal from a human readability standpoint. Currently, the output is as follows:
user rejected action (action="sendTransaction", reason="rejected", info={ "error": { "code": 4001, "message": "ethers-user-denied: MetaMask Tx Signature: User denied transaction signature." }, "payload": { "id": 25, "jsonrpc": "2.0", "method": "eth_sendTransaction", "params": [ { "from": "0x....", "gas": "0xa410", "to": "0x....", "value": "0x...." } ] } }, code=ACTION_REJECTED, version=6.6.2)
It seems overly verbose for the message property to include all this information, given that the same data is available in other properties of the error object.
To improve readability, it would be more beneficial if the error.message only contained the essential information related to the error, such as: user rejected action. This would make it more user-friendly and easier to understand at a glance.
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli)