MCPcopy
hub / github.com/bvaughn/react-error-boundary / getErrorMessage

Function getErrorMessage

lib/utils/getErrorMessage.ts:1–17  ·  view source on GitHub ↗
(thrown: unknown)

Source from the content-addressed store, hash-verified

1export function getErrorMessage(thrown: unknown): string | undefined {
2 switch (typeof thrown) {
3 case "object": {
4 if (
5 thrown !== null &&
6 "message" in thrown &&
7 typeof thrown.message === "string"
8 ) {
9 return thrown.message;
10 }
11 break;
12 }
13 case "string": {
14 return thrown;
15 }
16 }
17}

Callers 5

FallbackFunction · 0.85
RenderProp.tsxFile · 0.85
FallbackFunction · 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…