diff --git a/CHANGELOG.md b/CHANGELOG.md index d823609..40b4255 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] +### Added + +- Add error messages improvement + ## [1.21.0] - 2022-06-17 ### Added diff --git a/node/resolvers/Mutations/Users.ts b/node/resolvers/Mutations/Users.ts index 9bbd0d9..09262fd 100644 --- a/node/resolvers/Mutations/Users.ts +++ b/node/resolvers/Mutations/Users.ts @@ -136,8 +136,14 @@ export const addUser = async (_: any, params: any, ctx: Context) => { const userExists = await getUser({ masterdata, params }) if (userExists) { + if (userExists.orgId === params.orgId) { + throw new Error( + `User with email ${params.email} already exists in the organization, id="${userExists.id}"` + ) + } + throw new Error( - `User with email ${params.email} already exists, id="${userExists.id}"` + `User with email ${params.email} already exists in another organization, id="${userExists.id}"` ) }