MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / getErrorMessage

Function getErrorMessage

apps/ui/src/lib/errors/getErrorMessage.ts:6–24  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

4 * flag a `String(err)` / `err.toString()` / `${err}` call.
5 */
6export function getErrorMessage(error: unknown): string {
7 if (error instanceof Error) {
8 if (error.cause instanceof Error) {
9 return `${error.message} (cause: ${error.cause.message})`;
10 }
11
12 return error.message;
13 }
14
15 if (typeof error === "string") {
16 return error;
17 }
18
19 try {
20 return JSON.stringify(error);
21 } catch {
22 return "Unknown error";
23 }
24}

Callers 15

applyThemeFunction · 0.90
getFunction · 0.90
setFunction · 0.90
performRefreshFunction · 0.90
openapi.tsFile · 0.90
parseStreamMessageFunction · 0.90
useMarkNotificationReadFunction · 0.90
useArchiveNotificationFunction · 0.90
useLoginPageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected