metamask-error-message
v0.1.1
Published
> Get direct contract error message using metamask-error-message
Downloads
3
Readme
Metamask Error message
Get direct contract error message using metamask-error-message
Prerequisites
This project requires NodeJS (version 10 or later) and NPM.
Install package
npm i metamask-error-message
import and call function with your error object
import {getErrorMessage} from "metamask-error-message";
getErrorMessage(Error);
Full example
import {getErrorMessage} from "metamask-error-message";
const mintNFT = async () => {
try {
// Call Smart contract or web3 methods
} catch(error){
// Error message will be retrieved here
console.log(getErrorMessage(error));
}
}
Additional Parameters
| Parameter | Type | Default Value | | --- | --- | --- | | error | Error | - | | hideEVMessage | Boolean | False | | customMessage | String | "Something went wrong" |