Skip to content

Commit

Permalink
fix: Fix error output when sending email or message to Slack
Browse files Browse the repository at this point in the history
  • Loading branch information
meltyshev committed Apr 12, 2024
1 parent 1649905 commit 8a8c1fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/src/containers/LoginContainer.js
Expand Up @@ -20,7 +20,7 @@ const mapStateToProps = (state) => {
isSubmittingUsingOidc,
error,
withOidc: !!oidcConfig,
isOidcEnforced: oidcConfig && oidcConfig.isEnforced,
isOidcEnforced: !!oidcConfig && oidcConfig.isEnforced,
};
};

Expand Down
4 changes: 2 additions & 2 deletions server/api/helpers/utils/send-email.js
Expand Up @@ -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}`);
}
},
};
6 changes: 3 additions & 3 deletions server/api/helpers/utils/send-slack-message.js
Expand Up @@ -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}`);
}
},
};

0 comments on commit 8a8c1fe

Please sign in to comment.