Sms integration fix (#130)

* Twilio integration error handling improvement

* Mock-sms error triggering added
This commit is contained in:
Fabio Cigliano 2018-06-19 22:42:51 +12:00 committed by Josh Harvey
parent 9d6f3e6d9b
commit dd7e447e73
3 changed files with 31 additions and 19 deletions

View file

@ -1,29 +1,30 @@
require('es6-promise').polyfill()
var config = require('../lib/config')
var plugins = require('../lib/plugins')
var config = require('../lib/settings-loader')
var sms = require('../lib/sms')
var rand = Math.floor(Math.random() * 1e6)
var db = config.connection
var rec = {
email: {
subject: 'Test email ' + rand,
body: 'This is a test email from lamassu-server'
},
sms: {
toNumber: '666',
body: '[Lamassu] This is a test sms ' + rand
}
}
var db = config.connection
config.loadConfig(db)
config.loadLatest(db)
.then(function (config) {
plugins.configure(config)
plugins.sendMessage(rec)
sms.sendMessage(config, rec)
.then(function () {
console.log('Success.')
process.exit(0)
})
.catch(function (err) {
console.log(err.stack)
process.exit(1)
})
})