Skip to content

Commit

Permalink
refactor(api): keep error type "AlreadyRegisteredEmailError" in sco c…
Browse files Browse the repository at this point in the history
…ontext
  • Loading branch information
EmmanuelleBonnemay committed Nov 14, 2024
1 parent e01421b commit 60b8f71
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
OrganizationLearnerAlreadyLinkedToUserError,
} from '../../../src/shared/domain/errors.js';
import { urlBuilder } from '../../../src/shared/infrastructure/utils/url-builder.js';
import { InvalidOrAlreadyUsedEmailError } from '../../../src/identity-access-management/domain/errors.js';

const createAndReconcileUserToOrganizationLearner = async function ({
campaignCode,
Expand Down Expand Up @@ -119,6 +120,9 @@ function _createDomainUser(userAttributes) {
}

function _manageEmailAvailabilityError(error) {
if (error instanceof InvalidOrAlreadyUsedEmailError) {
error = new AlreadyRegisteredEmailError();
}
return _manageError(
error,
AlreadyRegisteredEmailError,
Expand Down

0 comments on commit 60b8f71

Please sign in to comment.