revert unrelated changes

This commit is contained in:
Abhinav 2023-03-02 11:19:37 +05:30
parent 407bd9fd9a
commit b3ec5423a6
2 changed files with 22 additions and 36 deletions

View file

@ -87,7 +87,6 @@ class ExportService {
exportType: ExportType exportType: ExportType
) { ) {
try { try {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
if (this.exportInProgress) { if (this.exportInProgress) {
this.electronAPIs.sendNotification( this.electronAPIs.sendNotification(
ExportNotification.IN_PROGRESS ExportNotification.IN_PROGRESS

View file

@ -2,46 +2,33 @@ import * as Sentry from '@sentry/nextjs';
import { addLogLine } from 'utils/logging'; import { addLogLine } from 'utils/logging';
import { getSentryUserID } from 'utils/user'; import { getSentryUserID } from 'utils/user';
export const logError = ( export const logError = async (
error: any, error: any,
msg: string, msg: string,
info?: Record<string, unknown>, info?: Record<string, unknown>,
skipAddLogLine = false skipAddLogLine = false
) => { ) => {
const main = async () => { if (isErrorUnnecessaryForSentry(error)) {
try { return;
if (isErrorUnnecessaryForSentry(error)) { }
return; const err = errorWithContext(error, msg);
} if (!skipAddLogLine) {
const err = errorWithContext(error, msg); addLogLine(
if (!skipAddLogLine) { `error: ${error?.name} ${error?.message} ${
addLogLine( error?.stack
`error: ${error?.name} ${error?.message} ${ } msg: ${msg} ${info ? `info: ${JSON.stringify(info)}` : ''}`
error?.stack );
} msg: ${msg} ${ }
info ? `info: ${JSON.stringify(info)}` : '' Sentry.captureException(err, {
}` level: Sentry.Severity.Info,
); user: { id: await getSentryUserID() },
} contexts: {
Sentry.captureException(err, { ...(info && {
level: Sentry.Severity.Info, info: info,
user: { id: await getSentryUserID() }, }),
contexts: { rootCause: { message: error?.message, completeError: error },
...(info && { },
info: info, });
}),
rootCause: {
message: error?.message,
completeError: error,
},
},
});
} catch (e) {
addLogLine('error in logError', e);
// ignore
}
};
void main();
}; };
// copy of errorWithContext to prevent importing error util // copy of errorWithContext to prevent importing error util