MCPcopy Index your code
hub / github.com/adobe/react-spectrum / errorToString

Function errorToString

packages/dev/mcp/shared/src/utils.ts:22–39  ·  view source on GitHub ↗
(err: unknown)

Source from the content-addressed store, hash-verified

20}
21
22export function errorToString(err: unknown): string {
23 if (err && typeof err === 'object' && 'stack' in err && typeof (err as any).stack === 'string') {
24 return (err as any).stack as string;
25 }
26 if (
27 err &&
28 typeof err === 'object' &&
29 'message' in err &&
30 typeof (err as any).message === 'string'
31 ) {
32 return (err as any).message as string;
33 }
34 try {
35 return JSON.stringify(err);
36 } catch {
37 return String(err);
38 }
39}
40
41// Default base URLs for each library
42const DEFAULT_S2_BASE = 'https://react-spectrum.adobe.com';

Callers 3

index.tsFile · 0.85
registerLibraryDocsToolsFunction · 0.85
index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected