MCPcopy Create free account
hub / github.com/Web3Auth/Auth / constructFallbackError

Function constructFallbackError

src/jrpc/jrpcEngine.ts:29–43  ·  view source on GitHub ↗
(error: Error)

Source from the content-addressed store, hash-verified

27};
28
29function constructFallbackError(error: Error): JRPCError {
30 const {
31 message = "",
32 code = errorCodes.rpc.internal,
33 stack = "Stack trace is not available.",
34 data = "",
35 } = error as { message?: string; code?: number; stack?: string; data?: string };
36 const codeNumber = isValidNumber(code) ? parseInt(code.toString()) : errorCodes.rpc.internal;
37 return {
38 message: message || error?.toString() || getMessageFromCode(codeNumber),
39 code: codeNumber,
40 stack,
41 data: data || message || error?.toString(),
42 };
43}
44
45/**
46 * A JSON-RPC request and response processor.

Callers 3

endMethod · 0.85
_handleMethod · 0.85
providerFromEngineFunction · 0.85

Calls 3

isValidNumberFunction · 0.90
getMessageFromCodeFunction · 0.90
toStringMethod · 0.65

Tested by

no test coverage detected