Email not found error returned correctyl

This commit is contained in:
Vins 2023-12-20 15:14:03 +01:00
parent 2f4bd04ab3
commit 7031bb1d48
2 changed files with 3 additions and 10 deletions

View File

@ -34,17 +34,10 @@ export default class UserController extends ApiController {
return; return;
} }
let user; const user = await this.idNotService.getOrCreateUser(idNotToken);
try {
user = await this.idNotService.getOrCreateUser(idNotToken);
} catch (error: any) {
this.httpUnauthorized(error);
return;
}
if(!user) { if(!user) {
this.httpUnauthorized(response); this.httpUnauthorized(response, "Email not found");
return; return;
} }

View File

@ -361,7 +361,7 @@ export default class IdNotService extends BaseService {
}; };
if(!userToAdd.contact.email) { if(!userToAdd.contact.email) {
throw new Error("No email found"); return null;
} }
let userHydrated = User.hydrate<User>(userToAdd); let userHydrated = User.hydrate<User>(userToAdd);