Skip to content

Commit

Permalink
Merge pull request #166 from vtex-apps/hotfix/B2BTEAM-1906-change-thr…
Browse files Browse the repository at this point in the history
…ow-to-return-duplicated-email

fix: Use return instead of throwing a duplicate email error.
  • Loading branch information
Rudge authored Oct 7, 2024
2 parents 3b54c00 + 459e5a1 commit e434ef4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed

- Use return instead of throwing a duplicate email error.

## [1.44.9] - 2024-10-03

### Fixed
Expand Down
7 changes: 4 additions & 3 deletions node/resolvers/Mutations/Users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ export const addUser = async (_: any, params: any, ctx: Context) => {
(org: any) => org.orgId === params.orgId && org.costId === params.costId
)
) {
throw new Error(
`User with email ${params.email} already exists in the organization and cost center`
)
return {
message: `Email already exists in the organization and cost center`,
status: 'duplicated-organization',
}
}

await createPermission({
Expand Down

0 comments on commit e434ef4

Please sign in to comment.