MCPcopy Create free account
hub / github.com/MetaMask/rpc-errors / getEthProviderError

Function getEthProviderError

src/errors.ts:266–276  ·  view source on GitHub ↗

* Get an Ethereum Provider error class instance. * * @param code - The error code. * @param arg - The error message or options bag. * @returns An instance of the EthereumProviderError class.

(
  code: number,
  arg?: JsonRpcErrorsArg<Data>,
)

Source from the content-addressed store, hash-verified

264 * @returns An instance of the {@link EthereumProviderError} class.
265 */
266function getEthProviderError<Data extends OptionalDataWithOptionalCause>(
267 code: number,
268 arg?: JsonRpcErrorsArg<Data>,
269): EthereumProviderError<Data> {
270 const [message, data] = parseOpts(arg);
271 return new EthereumProviderError(
272 code,
273 message ?? getMessageFromCode(code),
274 data,
275 );
276}
277
278/**
279 * Get an error message and optional data from an options bag.

Callers 1

errors.tsFile · 0.85

Calls 2

getMessageFromCodeFunction · 0.90
parseOptsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…