MCPcopy Create free account
hub / github.com/dailydotdev/apps / useError

Function useError

packages/shared/src/hooks/useError.ts:5–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { LogEvent } from '../lib/log';
4
5export function useError(): void {
6 const { logEvent } = useLogContext();
7
8 useEffect(() => {
9 if (logEvent) {
10 window.onerror = (msg, url, line, col, error) => {
11 logEvent({
12 event_name: LogEvent.GlobalError,
13 extra: JSON.stringify({
14 msg,
15 url,
16 line,
17 col,
18 error,
19 }),
20 });
21 };
22 }
23 }, [logEvent]);
24}

Callers 3

AppFunction · 0.90
AppFunction · 0.90
InternalAppFunction · 0.90

Calls 2

useLogContextFunction · 0.90
logEventFunction · 0.85

Tested by

no test coverage detected