MCPcopy
hub / github.com/msgbyte/tianji / showErrorToast

Function showErrorToast

src/client/utils/error.ts:7–27  ·  view source on GitHub ↗
(err: any)

Source from the content-addressed store, hash-verified

5 * Show common error toast with auto process error object
6 */
7export function showErrorToast(err: any) {
8 console.error(err);
9
10 if (err instanceof TRPCClientError) {
11 try {
12 const json = JSON.parse(err.message);
13 toast.error(json[0].message);
14 } catch {
15 toast.error(err.message);
16 }
17
18 return;
19 }
20
21 if (err instanceof Error) {
22 toast.error(err.message);
23 return;
24 }
25
26 toast.error(String(err));
27}

Callers 3

SurveyEventTableFunction · 0.90
PageComponentFunction · 0.90

Calls 2

errorMethod · 0.80
parseMethod · 0.80

Tested by

no test coverage detected