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

Function getOriginalMessage

src/utils.ts:177–187  ·  view source on GitHub ↗

* Attempts to extract the original `message` property from an error value of uncertain shape. * * @param error - The error in question. * @returns The original message, if it exists and is a non-empty string.

(error: unknown)

Source from the content-addressed store, hash-verified

175 * @returns The original message, if it exists and is a non-empty string.
176 */
177function getOriginalMessage(error: unknown): string | undefined {
178 if (
179 isObject(error) &&
180 hasProperty(error, 'message') &&
181 typeof error.message === 'string' &&
182 error.message.length > 0
183 ) {
184 return error.message;
185 }
186 return undefined;
187}
188
189/**
190 * Check if the given code is a valid JSON-RPC server error code.

Callers 1

buildErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…