From 8a8c1fee0c650cfe410f2abc4756da1b4bc6cc3d Mon Sep 17 00:00:00 2001 From: Maksim Eltyshev Date: Fri, 12 Apr 2024 12:07:19 +0200 Subject: [PATCH] fix: Fix error output when sending email or message to Slack --- client/src/containers/LoginContainer.js | 2 +- server/api/helpers/utils/send-email.js | 4 ++-- server/api/helpers/utils/send-slack-message.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/containers/LoginContainer.js b/client/src/containers/LoginContainer.js index 881b65b0..1a167886 100755 --- a/client/src/containers/LoginContainer.js +++ b/client/src/containers/LoginContainer.js @@ -20,7 +20,7 @@ const mapStateToProps = (state) => { isSubmittingUsingOidc, error, withOidc: !!oidcConfig, - isOidcEnforced: oidcConfig && oidcConfig.isEnforced, + isOidcEnforced: !!oidcConfig && oidcConfig.isEnforced, }; }; diff --git a/server/api/helpers/utils/send-email.js b/server/api/helpers/utils/send-email.js index 7b8d08bf..02593f88 100644 --- a/server/api/helpers/utils/send-email.js +++ b/server/api/helpers/utils/send-email.js @@ -23,9 +23,9 @@ module.exports = { from: sails.config.custom.smtpFrom, }); - sails.log.info('Email sent: %s', info.messageId); + sails.log.info(`Email sent: ${info.messageId}`); } catch (error) { - sails.log.error(error); // TODO: provide description text? + sails.log.error(`Error sending email: ${error}`); } }, }; diff --git a/server/api/helpers/utils/send-slack-message.js b/server/api/helpers/utils/send-slack-message.js index 573fcf87..510ae1b2 100644 --- a/server/api/helpers/utils/send-slack-message.js +++ b/server/api/helpers/utils/send-slack-message.js @@ -35,19 +35,19 @@ module.exports = { body: JSON.stringify(body), }); } catch (error) { - sails.log.error(error); // TODO: provide description text? + sails.log.error(`Error sending to Slack: ${error}`); return; } if (!response.ok) { - sails.log.error('Error sending to Slack: %s', response.error); + sails.log.error(`Error sending to Slack: ${response.error}`); return; } const responseJson = await response.json(); if (!responseJson.ok) { - sails.log.error('Error sending to Slack: %s', responseJson.error); + sails.log.error(`Error sending to Slack: ${responseJson.error}`); } }, };