MCPcopy
hub / github.com/unicity-sphere/sphere / getErrorMessage

Function getErrorMessage

src/sdk/errors.ts:44–50  ·  view source on GitHub ↗
(err: unknown)

Source from the content-addressed store, hash-verified

42}
43
44export function getErrorMessage(err: unknown): string {
45 if (isSphereError(err)) {
46 return FRIENDLY_OVERRIDES[err.code] ?? humanizeRawError(err.message);
47 }
48 if (err instanceof Error) return humanizeRawError(err.message);
49 return 'Something went wrong';
50}
51
52export function getErrorCode(err: unknown): SphereErrorCode | null {
53 return isSphereError(err) ? err.code : null;

Callers 15

handleSubmitNametagFunction · 0.90
handleSwapFunction · 0.90
handleTopUpFunction · 0.90
handleActionFunction · 0.90
LookupModalFunction · 0.90
handleDetailsNextFunction · 0.90
handleSendFunction · 0.90
handleDetailsNextFunction · 0.90
handleSendRequestFunction · 0.90
handleSubmitFunction · 0.90
handleSendFunction · 0.90
handleSendDMFunction · 0.90

Calls 1

humanizeRawErrorFunction · 0.85

Tested by

no test coverage detected