diff --git a/lib/models/keystone.js b/lib/models/keystone.js index 81281cf9..2833a8eb 100644 --- a/lib/models/keystone.js +++ b/lib/models/keystone.js @@ -34,7 +34,13 @@ function getToken(trust, callback) { const host = config.authentication.host; const port = config.authentication.port; var trustConf = configTrust.trusts.find((item) => item.id === trust); - + // check trust was found or log it + if (!trustConf) { + logger.error('Trust [%s] not found in configTrust file', trust); + callback(new errors.TokenRetrievalError(trust, + 'trust not found' + trust) + ); + } var options = { url: 'http://' + host + ':' + port + '/v3/auth/tokens', method: 'POST',