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,13 +327,22 @@ DataSource.prototype.setup = function (name, settings) {
|
||||||
|
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
if ('function' === typeof connector.initialize) {
|
try {
|
||||||
// Call the async initialize method
|
if ('function' === typeof connector.initialize) {
|
||||||
connector.initialize(this, postInit);
|
// Call the async initialize method
|
||||||
} else if ('function' === typeof connector) {
|
connector.initialize(this, postInit);
|
||||||
// Use the connector constructor directly
|
} else if ('function' === typeof connector) {
|
||||||
this.connector = new connector(this.settings);
|
// Use the connector constructor directly
|
||||||
postInit();
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue