Throw if error on sendSms

This commit is contained in:
Ralfs 2021-04-13 23:41:35 +03:00
parent 8f87c2696c
commit 7d871e7a58
2 changed files with 1 additions and 4 deletions

View File

@ -87,7 +87,6 @@ const runCron = async () => {
const marginAccount = await client.getMarginAccount(connection, marginAccountPk, dexProgramId);
const collateralRatio = marginAccount.getCollateralRatio(mangoGroups[alert.mangoGroupPk]['mangoGroup'], mangoGroups[alert.mangoGroupPk]['prices']);
if ((100 * collateralRatio) <= alert.collateralRatioThresh) {
console.log("Got an alert");
let message = MESSAGE.replace('@ratio@', alert.collateralRatioThresh);
message += marginAccount.toPrettyString(
mangoGroups[alert.mangoGroupPk]['mangoGroup'],

View File

@ -58,9 +58,7 @@ const sendSms = (phoneNumber: string, message: string) => {
from: config.twilioNumber,
to: phoneNumber,
body: message,
})
.then(message => console.log(message.sid))
.catch(error => console.error(error))
}).catch(error => { throw error })
}
const sendEmail = (email: string, message: string) => {