From 9e52faa1bb2832a6b52000cfcb78dd658ccc0bb0 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 5 Apr 2023 12:40:58 +0100 Subject: [PATCH] Adjust mail.send function Signed-off-by: Fred Boniface --- src/services/register.services.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/services/register.services.js b/src/services/register.services.js index 7144b13..456b218 100644 --- a/src/services/register.services.js +++ b/src/services/register.services.js @@ -15,17 +15,11 @@ async function createRegKey(eml){ if (await message == false) { // This error should be handled in the upstream function const err = new Error("Message generation error"); log.out(`registerServices.createRegKey: Error generating registration email`, "err") - return 500 + return 500; } - try { // Send the email - await mail.send(message); - } catch(err){ // HTTP 500 if sen failed - return 500 - } - return 201 // These returns still need handling - } else { - return 401 // As above + return await mail.send(message); } + return 401; } async function regUser(req) {