diff --git a/lib/models/keystone.js b/lib/models/keystone.js index 10807557..448d876d 100644 --- a/lib/models/keystone.js +++ b/lib/models/keystone.js @@ -60,8 +60,7 @@ function getToken(trust, callback) { // check trust was found or log it if (!trustConf) { logger.error('Trust %s not found in configTrust file with content %j', trust, configTrust); - alarm.raise(alarm.AUTH); - callback(new errors.TokenRetrievalError(trust, 'trust not found' + trust)); + throw errors.TokenRetrievalError(trust, 'trust not found' + trust); } var options = { url: 'http://' + trustConf.host + ':' + trustConf.port + '/v3/auth/tokens', diff --git a/lib/models/updateAction.js b/lib/models/updateAction.js index ef387742..a40e23d0 100644 --- a/lib/models/updateAction.js +++ b/lib/models/updateAction.js @@ -474,8 +474,8 @@ function doRequestV2(action, event, token, callback) { function makeTokenListenerFunc(action, event, version, callback) { return function tokenHandlerFunc(error, token) { logger.debug('tokenHandlerFunc error:%s token:%s', error, token); - if (error) { - throw error; + if (error || !token) { + return callback(error); } else { logger.debug('tokenHandlerFunc retrying with %s', token); return doRequestV2(action, event, token, function cbDoReqUpdAxn(error, data) {