Add externalUserId in ThirdPartyIdentityExistsError info (#17709)

* Add externalUserId in ThirdPartyIdentityExistsError info

* format fix

GitOrigin-RevId: 85370987ff7a9caa54102bf9013ebc655a2d383b
This commit is contained in:
Domagoj Kriskovic 2024-04-03 10:02:13 +02:00 committed by Copybot
parent 92a58c8f3b
commit b3d2d73136

View file

@ -100,7 +100,11 @@ function link(
// projection includes thirdPartyIdentifiers for tests
User.findOneAndUpdate(query, update, { new: 1 }, (err, res) => {
if (err && err.code === 11000) {
callback(new Errors.ThirdPartyIdentityExistsError())
callback(
new Errors.ThirdPartyIdentityExistsError({
info: { externalUserId },
})
)
} else if (err != null) {
callback(err)
} else if (res) {