From 7031bb1d4888c698d0c26966815ce89c2c56f77e Mon Sep 17 00:00:00 2001 From: Vins Date: Wed, 20 Dec 2023 15:14:03 +0100 Subject: [PATCH] Email not found error returned correctyl --- src/app/api/idnot/UserController.ts | 11 ++--------- src/services/common/IdNotService/IdNotService.ts | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) 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);