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

Function getJsonRpcError

src/errors.ts:251–257  ·  view source on GitHub ↗

* Get a generic JSON-RPC error class instance. * * @param code - The error code. * @param arg - The error message or options bag. * @returns An instance of the JsonRpcError class.

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

Source from the content-addressed store, hash-verified

249 * @returns An instance of the {@link JsonRpcError} class.
250 */
251function getJsonRpcError<Data extends OptionalDataWithOptionalCause>(
252 code: number,
253 arg?: JsonRpcErrorsArg<Data>,
254): JsonRpcError<Data> {
255 const [message, data] = parseOpts(arg);
256 return new JsonRpcError(code, message ?? getMessageFromCode(code), data);
257}
258
259/**
260 * Get an Ethereum Provider error class instance.

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…