🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

metamask-error-message

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metamask-error-message

> Get direct contract error message using metamask-error-message

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

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

ParameterTypeDefault Value
errorError-
hideEVMessageBooleanFalse
customMessageString"Something went wrong"

FAQs

Package last updated on 29 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts