Skip to content

Commit

Permalink
chore(ai-help): measure errors
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Dec 13, 2023
1 parent db269c7 commit ae1044d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions client/src/plus/ai-help/use-ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,16 @@ export function useAiChat({
const remoteQuota = useRemoteQuota();
const flushSources = useRef<() => void>();

const handleError = useCallback((err: any) => {
eventSourceRef.current?.close();
eventSourceRef.current = undefined;
setLoadingState("failed");
console.error(err);
}, []);
const handleError = useCallback(
(err: any) => {
gleanClick(`${AI_HELP}: error`);
eventSourceRef.current?.close();
eventSourceRef.current = undefined;
setLoadingState("failed");
console.error(err);
},
[gleanClick]
);

const reset = useCallback(() => {
setPreviousChatId(chatId);
Expand Down

0 comments on commit ae1044d

Please sign in to comment.