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);
|
||||
setLogs(logs);
|
||||
} catch (e) {
|
||||
logError(e, 'failed to save log line');
|
||||
// don't throw
|
||||
logError(e, 'failed to save log line', undefined, true);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,17 +6,20 @@ import { getSentryUserID } from 'utils/user';
|
|||
export const logError = (
|
||||
error: any,
|
||||
msg: string,
|
||||
info?: Record<string, unknown>
|
||||
info?: Record<string, unknown>,
|
||||
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 });
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue