diff --git a/lib/customers.js b/lib/customers.js index ebbc76b5..0f68f1ed 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -587,7 +587,7 @@ function formatSubscriberInfo(customer) { const subscriberInfo = customer.subscriberInfo if(!subscriberInfo) return customer const result = subscriberInfo.result - if(subscriberInfo.status !== 'successful' || _.isEmpty(result)) return customer + if(_.isEmpty(result)) return _.omit(['subscriberInfo'], customer) const name = _.get('belongs_to.name')(result) const street = _.get('current_addresses[0].street_line_1')(result) diff --git a/lib/plugins/sms/twilio/twilio.js b/lib/plugins/sms/twilio/twilio.js index eb9fb0c4..bdfc3843 100644 --- a/lib/plugins/sms/twilio/twilio.js +++ b/lib/plugins/sms/twilio/twilio.js @@ -45,6 +45,12 @@ function getLookup (account, number) { .fetch({ addOns: ['lamassu_ekata'] }) }) .then(info => info.addOns.results['lamassu_ekata']) + .then(info => { + if (info.status !== 'successful') { + throw new Error(`Twilio error: ${info.message}`) + } + return info + }) .catch(err => { if (_.includes(err.code, BAD_NUMBER_CODES)) { const badNumberError = new Error(err.message) diff --git a/new-lamassu-admin/src/pages/Customers/CustomerProfile.js b/new-lamassu-admin/src/pages/Customers/CustomerProfile.js index 18cccd18..cbc79296 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerProfile.js +++ b/new-lamassu-admin/src/pages/Customers/CustomerProfile.js @@ -745,7 +745,7 @@ const RetrieveDataDialog = ({ {error && ( - Failed to save + Failed to fetch additional data )}