logError for saveLogLine was again calling the same function causing an infinite loop
This commit is contained in:
parent
519828a954
commit
d0555185cf
|
@ -83,8 +83,8 @@ function saveLogLine(log: Log) {
|
||||||
logs.push(log);
|
logs.push(log);
|
||||||
setLogs(logs);
|
setLogs(logs);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logError(e, 'failed to save log line');
|
logError(e, 'failed to save log line', undefined, true);
|
||||||
// don't throw
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,17 +6,20 @@ import { getSentryUserID } from 'utils/user';
|
||||||
export const logError = (
|
export const logError = (
|
||||||
error: any,
|
error: any,
|
||||||
msg: string,
|
msg: string,
|
||||||
info?: Record<string, unknown>
|
info?: Record<string, unknown>,
|
||||||
|
skipAddLogLine = false
|
||||||
) => {
|
) => {
|
||||||
if (isErrorUnnecessaryForSentry(error)) {
|
if (isErrorUnnecessaryForSentry(error)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const err = errorWithContext(error, msg);
|
const err = errorWithContext(error, msg);
|
||||||
addLogLine(
|
if (!skipAddLogLine) {
|
||||||
`error: ${error?.name} ${error?.message} ${
|
addLogLine(
|
||||||
error?.stack
|
`error: ${error?.name} ${error?.message} ${
|
||||||
} msg: ${msg} info: ${JSON.stringify(info)}`
|
error?.stack
|
||||||
);
|
} msg: ${msg} info: ${JSON.stringify(info)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
if (isDEVSentryENV()) {
|
if (isDEVSentryENV()) {
|
||||||
console.log(error, { msg, info });
|
console.log(error, { msg, info });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue