Skip to content

Commit

Permalink
fix: Avoid notifying watch.settings on uncaught errors (#33376)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman authored Sep 27, 2024
1 parent 92e366e commit b17b3be
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { Meteor } from 'meteor/meteor';

import { throttledCounter } from '../../../../lib/utils/throttledCounter';
import { sendMessage } from '../../../lib/server/functions/sendMessage';
import { notifyOnSettingChanged } from '../../../lib/server/lib/notifyListener';
import { settings } from '../../../settings/server';

const incException = throttledCounter((counter) => {
Settings.incrementValueById('Uncaught_Exceptions_Count', counter, { returnDocument: 'after' })
.then(({ value }) => {
if (value) {
void notifyOnSettingChanged(value);
settings.set(value);
}
})
.catch(console.error);
Expand Down Expand Up @@ -118,5 +117,12 @@ process.on('unhandledRejection', (error) => {

process.on('uncaughtException', async (error) => {
incException();

console.error('=== UnCaughtException ===');
console.error(error);
console.error('-------------------------');
console.error('Errors like this can cause oplog processing errors.');
console.error('===========================');

void errorHandler.trackError(error.message, error.stack);
});

0 comments on commit b17b3be

Please sign in to comment.