From 50819b6f20bcfb13eff09611a55e1a3daec006a5 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Fri, 24 Nov 2023 10:32:33 +0100 Subject: [PATCH] fix: add debug (#491) --- .../api/commande/controllers/commande.js | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/back-strapi/api/commande/controllers/commande.js b/back-strapi/api/commande/controllers/commande.js index f5c29763..36e19013 100644 --- a/back-strapi/api/commande/controllers/commande.js +++ b/back-strapi/api/commande/controllers/commande.js @@ -422,32 +422,35 @@ module.exports = { ); if (!referent.openingHours) referent.openingHours = {}; - - await strapi.plugins["email"].services.email.sendTemplatedEmail( - { - to: entity.email, - }, - EMAIL_ORDER_CONFIRM_REF, - { - order: Object.assign( - _.pick(entity, [ - "name", - "first_name", - "last_name", - "id", - "address", - "address_zipcode", - "address_city", - ]), - { - delivery_name: delivery_name, - custom_text: custom_text, - box: _.pick(box, ["title"]), - } - ), - referent: Object.assign(_.pick(referent, ["openingHours"])), - } - ); + try { + await strapi.plugins["email"].services.email.sendTemplatedEmail( + { + to: entity.email, + }, + EMAIL_ORDER_CONFIRM_REF, + { + order: Object.assign( + _.pick(entity, [ + "name", + "first_name", + "last_name", + "id", + "address", + "address_zipcode", + "address_city", + ]), + { + delivery_name: delivery_name, + custom_text: custom_text, + box: _.pick(box, ["title"]), + } + ), + referent: Object.assign(_.pick(referent, ["openingHours"])), + } + ); + } catch(e) { + console.error("Email referent error", e); + } } if (users_email.length > 0) { strapi.log.info(