diff --git a/packages/generator-feathers/generators/connection/templates/mongodb.js b/packages/generator-feathers/generators/connection/templates/mongodb.js index 0f96be6176..44e159ed47 100644 --- a/packages/generator-feathers/generators/connection/templates/mongodb.js +++ b/packages/generator-feathers/generators/connection/templates/mongodb.js @@ -1,5 +1,6 @@ const parse = require('mongodb-core').parseConnectionString; const MongoClient = require('mongodb').MongoClient; +const logger = require('./logger'); module.exports = function (app) { const config = app.get('mongodb'); @@ -11,6 +12,8 @@ module.exports = function (app) { const dbName = parse(config, () => {}); return client.db(dbName); + }).catch(error => { + logger.error(error); }); app.set('mongoClient', promise); diff --git a/packages/generator-feathers/generators/connection/templates/rethinkdb.js b/packages/generator-feathers/generators/connection/templates/rethinkdb.js index 5dd96646fc..721cfd6380 100644 --- a/packages/generator-feathers/generators/connection/templates/rethinkdb.js +++ b/packages/generator-feathers/generators/connection/templates/rethinkdb.js @@ -1,4 +1,5 @@ const rethinkdbdash = require('rethinkdbdash'); +const logger = require('./logger'); module.exports = function (app) { const config = app.get('rethinkdb'); @@ -16,7 +17,11 @@ module.exports = function (app) { const service = app.service(path); if (typeof service.init === 'function') { - promise = promise.then(() => service.init()); + promise = promise.then(() => { + service.init(); + }).catch(error => { + logger.error(error); + }); } });