diff --git a/services/web/app/src/Features/User/UserUpdater.js b/services/web/app/src/Features/User/UserUpdater.js index 0ccdb1bd1b..b7fc030ed8 100644 --- a/services/web/app/src/Features/User/UserUpdater.js +++ b/services/web/app/src/Features/User/UserUpdater.js @@ -371,13 +371,15 @@ async function addAffiliationForNewUser( { $unset: { 'emails.$.affiliationUnchecked': 1 } } ) } catch (error) { - throw OError.tag( - error, - 'could not remove affiliationUnchecked flag for user on create', - { - userId, - email, - } + logger.error( + OError.tag( + error, + 'could not remove affiliationUnchecked flag for user on create', + { + userId, + email, + } + ) ) } } diff --git a/services/web/test/unit/src/User/UserUpdaterTests.js b/services/web/test/unit/src/User/UserUpdaterTests.js index 02686b6e2f..bff3909d8e 100644 --- a/services/web/test/unit/src/User/UserUpdaterTests.js +++ b/services/web/test/unit/src/User/UserUpdaterTests.js @@ -160,6 +160,14 @@ describe('UserUpdater', function () { { $unset: { 'emails.$.affiliationUnchecked': 1 } } ) }) + + it('should not throw if removing affiliationUnchecked flag errors', async function () { + this.db.users.updateOne.rejects(new Error('nope')) + await this.UserUpdater.promises.addAffiliationForNewUser( + this.user._id, + this.newEmail + ) + }) }) describe('changeEmailAddress', function () {