diff --git a/src/lib/rollbar/rollbar.tsx b/src/lib/rollbar/rollbar.tsx index 484a5e64..c16513ca 100644 --- a/src/lib/rollbar/rollbar.tsx +++ b/src/lib/rollbar/rollbar.tsx @@ -3,3 +3,16 @@ export const reportHandledError = (description: string, e?: any, info?: any) => // @ts-ignore Rollbar.error(description, e, info); }; + +let reported = false; + +export const reportHandledErrorOnce = (description: string, e?: any, info?: any) => { + if (reported) { + return; + } + reported = true; + console.error(e); + // @ts-ignore + Rollbar.error(description, e, info); +}; + diff --git a/src/lib/voice-playback/speak.ts b/src/lib/voice-playback/speak.ts index 89aa3afd..343d6204 100644 --- a/src/lib/voice-playback/speak.ts +++ b/src/lib/voice-playback/speak.ts @@ -1,4 +1,7 @@ -import { reportHandledError } from "../rollbar/rollbar.tsx"; +import { + reportHandledError, + reportHandledErrorOnce +} from "../rollbar/rollbar.tsx"; export enum SpeakLanguageEnum { AmericanEnglish = "en-US", @@ -48,7 +51,7 @@ export const speak = (text: string, language: SpeakLanguageEnum) => { typeof SpeechSynthesisUtterance !== "undefined"; if (!isSpeechSynthesisSupported) { - reportHandledError( + reportHandledErrorOnce( `Speech synthesis is not supported in this browser. Browser info: ${navigator.userAgent}`, ); return;