diff --git a/CHANGELOG.md b/CHANGELOG.md index e7079c2..a0366dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/node/resolvers/Mutations/Users.ts b/node/resolvers/Mutations/Users.ts index 2323237..9ff0366 100644 --- a/node/resolvers/Mutations/Users.ts +++ b/node/resolvers/Mutations/Users.ts @@ -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({