Merge pull request #859 from strongloop/fix/err-msg-on-connector-error
Improve error message on connector init error
This commit is contained in:
commit
ac94c2b988
|
@ -327,6 +327,7 @@ DataSource.prototype.setup = function (name, settings) {
|
||||||
|
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
try {
|
||||||
if ('function' === typeof connector.initialize) {
|
if ('function' === typeof connector.initialize) {
|
||||||
// Call the async initialize method
|
// Call the async initialize method
|
||||||
connector.initialize(this, postInit);
|
connector.initialize(this, postInit);
|
||||||
|
@ -335,6 +336,14 @@ DataSource.prototype.setup = function (name, settings) {
|
||||||
this.connector = new connector(this.settings);
|
this.connector = new connector(this.settings);
|
||||||
postInit();
|
postInit();
|
||||||
}
|
}
|
||||||
|
} catch(err) {
|
||||||
|
if (err.message) {
|
||||||
|
err.message = 'Cannot initialize connector ' +
|
||||||
|
JSON.stringify(connector.name || name) + ': ' +
|
||||||
|
err.message;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dataSource.connect = function (cb) {
|
dataSource.connect = function (cb) {
|
||||||
|
|
Loading…
Reference in New Issue