diff --git a/src/app/api/idnot/UserController.ts b/src/app/api/idnot/UserController.ts index f614b419..8b448b2b 100644 --- a/src/app/api/idnot/UserController.ts +++ b/src/app/api/idnot/UserController.ts @@ -34,17 +34,10 @@ export default class UserController extends ApiController { return; } - let user; - - try { - user = await this.idNotService.getOrCreateUser(idNotToken); - } catch (error: any) { - this.httpUnauthorized(error); - return; - } + const user = await this.idNotService.getOrCreateUser(idNotToken); if(!user) { - this.httpUnauthorized(response); + this.httpUnauthorized(response, "Email not found"); return; } diff --git a/src/services/common/IdNotService/IdNotService.ts b/src/services/common/IdNotService/IdNotService.ts index edc58508..eca8fe37 100644 --- a/src/services/common/IdNotService/IdNotService.ts +++ b/src/services/common/IdNotService/IdNotService.ts @@ -361,7 +361,7 @@ export default class IdNotService extends BaseService { }; if(!userToAdd.contact.email) { - throw new Error("No email found"); + return null; } let userHydrated = User.hydrate(userToAdd);