Improve error message on connector init error

This commit is contained in:
Miroslav Bajtoš 2016-02-26 14:00:24 +01:00
parent dd4530cad6
commit 9dcf30efe9
1 changed files with 16 additions and 7 deletions

View File

@ -327,6 +327,7 @@ DataSource.prototype.setup = function (name, settings) {
}.bind(this);
try {
if ('function' === typeof connector.initialize) {
// Call the async initialize method
connector.initialize(this, postInit);
@ -335,6 +336,14 @@ DataSource.prototype.setup = function (name, settings) {
this.connector = new connector(this.settings);
postInit();
}
} catch(err) {
if (err.message) {
err.message = 'Cannot initialize connector ' +
JSON.stringify(connector.name || name) + ': ' +
err.message;
}
throw err;
}
}
dataSource.connect = function (cb) {