Skip to content

Commit

Permalink
fix: catch unhandled error when adding or refreshing oauth apps (#35089)
Browse files Browse the repository at this point in the history
  • Loading branch information
julio-rocketchat authored Feb 4, 2025
1 parent 3fda478 commit a36d02f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-camels-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Adds wrapExceptions to handle an unhandled promise rejection when adding and/or updating OAuth apps
5 changes: 3 additions & 2 deletions apps/meteor/server/services/meteor/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { api, ServiceClassInternal } from '@rocket.chat/core-services';
import type { AutoUpdateRecord, IMeteor } from '@rocket.chat/core-services';
import type { ILivechatAgent, LoginServiceConfiguration, UserStatus } from '@rocket.chat/core-typings';
import { LoginServiceConfiguration as LoginServiceConfigurationModel, Users } from '@rocket.chat/models';
import { wrapExceptions } from '@rocket.chat/tools';
import { Meteor } from 'meteor/meteor';
import { MongoInternals } from 'meteor/mongo';

Expand Down Expand Up @@ -146,14 +147,14 @@ export class MeteorService extends ServiceClassInternal implements IMeteor {
this.onEvent('watch.loginServiceConfiguration', ({ clientAction, id, data }) => {
if (clientAction === 'removed') {
serviceConfigCallbacks.forEach((callbacks) => {
callbacks.removed?.(id);
wrapExceptions(() => callbacks.removed?.(id)).suppress();
});
return;
}

if (data) {
serviceConfigCallbacks.forEach((callbacks) => {
callbacks[clientAction === 'inserted' ? 'added' : 'changed']?.(id, data);
wrapExceptions(() => callbacks[clientAction === 'inserted' ? 'added' : 'changed']?.(id, data)).suppress();
});
}
});
Expand Down

0 comments on commit a36d02f

Please sign in to comment.