From 5335d128021d54eb4a90efd0bd90d425d5487ae7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 17 Nov 2021 19:37:35 +0100 Subject: [PATCH] catch error on createUser and log them --- backend/src/webhook/elopage.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/backend/src/webhook/elopage.ts b/backend/src/webhook/elopage.ts index 0db26bf9c..945a2a24c 100644 --- a/backend/src/webhook/elopage.ts +++ b/backend/src/webhook/elopage.ts @@ -145,14 +145,19 @@ export const elopageWebhook = async (req: any, res: any): Promise => { randomBytes(8).toString('hex') + email + '!aA1' + randomBytes(8).toString('hex') const userResolver = new UserResolver() - userResolver.createUser({ - email, - firstName, - lastName, - password, - language: 'default', - publisherId: loginElopgaeBuy.publisherId, - }) + try { + await userResolver.createUser({ + email, + firstName, + lastName, + password, + language: 'default', + publisherId: loginElopgaeBuy.publisherId, + }) + } catch (error) { + // eslint-disable-next-line no-console + console.log(`Could not create User for ${email}. Following Error occured:`, error) + } } }