diff --git a/src/utils/logging/index.ts b/src/utils/logging/index.ts index 9a1a4f02e..123dc9b38 100644 --- a/src/utils/logging/index.ts +++ b/src/utils/logging/index.ts @@ -83,8 +83,8 @@ function saveLogLine(log: Log) { logs.push(log); setLogs(logs); } catch (e) { - logError(e, 'failed to save log line'); - // don't throw + logError(e, 'failed to save log line', undefined, true); + // ignore } } diff --git a/src/utils/sentry/index.ts b/src/utils/sentry/index.ts index 19cbd6d15..c5fc82676 100644 --- a/src/utils/sentry/index.ts +++ b/src/utils/sentry/index.ts @@ -6,17 +6,20 @@ import { getSentryUserID } from 'utils/user'; export const logError = ( error: any, msg: string, - info?: Record + info?: Record, + skipAddLogLine = false ) => { if (isErrorUnnecessaryForSentry(error)) { return; } const err = errorWithContext(error, msg); - addLogLine( - `error: ${error?.name} ${error?.message} ${ - error?.stack - } msg: ${msg} info: ${JSON.stringify(info)}` - ); + if (!skipAddLogLine) { + addLogLine( + `error: ${error?.name} ${error?.message} ${ + error?.stack + } msg: ${msg} info: ${JSON.stringify(info)}` + ); + } if (isDEVSentryENV()) { console.log(error, { msg, info }); }