Skip to content

Commit 327c785

Browse files
committed
Return error if the connector does not implement
* Return error if the connector does not implement `replaceById`
1 parent c4b2921 commit 327c785

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/dao.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,8 +2638,14 @@ DataAccessObject.replaceById = function(id, data, options, cb) {
26382638
assert(typeof cb === 'function', 'The cb argument must be a function');
26392639

26402640
var connector = this.getConnector();
2641-
assert(typeof connector.replaceById === 'function',
2642-
'replaceById() must be implemented by the connector');
2641+
2642+
if (typeof connector.replaceById !== 'function') {
2643+
var err = new Error(g.f(
2644+
'The connector %s does not support {{replaceById}} operation. This is not a bug in LoopBack. ' +
2645+
'Please contact the authors of the connector, preferably via GitHub issues.',
2646+
connector.name));
2647+
return cb(err);
2648+
}
26432649

26442650
var pkName = idName(this);
26452651
if (!data[pkName]) data[pkName] = id;

0 commit comments

Comments
 (0)