Merge pull request #1040 from strongloop/err_connector_not_implemented_replaceById_2.x
Return error if connector does not implement
This commit is contained in:
commit
a8a105c3ee
|
@ -2633,8 +2633,13 @@ DataAccessObject.replaceById = function(id, data, options, cb) {
|
||||||
assert(typeof cb === 'function', 'The cb argument must be a function');
|
assert(typeof cb === 'function', 'The cb argument must be a function');
|
||||||
|
|
||||||
var connector = this.getConnector();
|
var connector = this.getConnector();
|
||||||
assert(typeof connector.replaceById === 'function',
|
|
||||||
'replaceById() must be implemented by the connector');
|
if (typeof connector.replaceById !== 'function') {
|
||||||
|
var err = new Error('The connector ' + connector.name + ' does not support ' +
|
||||||
|
'replaceById operation. This is not a bug in LoopBack. ' +
|
||||||
|
'Please contact the authors of the connector, preferably via GitHub issues.');
|
||||||
|
return cb(err);
|
||||||
|
}
|
||||||
|
|
||||||
var pkName = idName(this);
|
var pkName = idName(this);
|
||||||
if (!data[pkName]) data[pkName] = id;
|
if (!data[pkName]) data[pkName] = id;
|
||||||
|
|
Loading…
Reference in New Issue