Skip to content

Commit

Permalink
Further improve error message (add recommendation of how you're suppo…
Browse files Browse the repository at this point in the history
…sed to deal with this)
  • Loading branch information
mikermcneil committed Sep 27, 2017
1 parent dc40bd3 commit 069ec38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/waterline/methods/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,11 @@ module.exports = function destroy(/* criteria, explicitCbMaybe, metaContainer */
message: 'Failed to run the "cascade" polyfill. Could not propagate the potential '+
'destruction of '+(idsOfRecordsBeingDestroyedMaybe.length===1?'this '+WLModel.identity+' record':('these '+idsOfRecordsBeingDestroyedMaybe.length+' '+WLModel.identity+' records'))+'.\n'+
'Details:\n'+
' '+err.message+'\n'
' '+err.message+'\n'+
'\n'+
'This error originated from the fact that the "cascade" polyfill was enabled for this query.\n'+
'Tip: Try reordering your .destroy() calls.\n'+
' [?] See https://sailsjs.com/support for more help.\n'
}, omen));
}//•
else { return next(err); }
Expand Down
2 changes: 1 addition & 1 deletion lib/waterline/methods/replace-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ module.exports = function replaceCollection(/* targetRecordIds?, collectionAttrN
message:
'Cannot '+(query.associatedIds.length===0?'wipe':'replace')+' the contents of '+
'association (`'+query.collectionAttrName+'`) because there '+
(numCollisions===1?('is one conflicting `'+WLChild.identity+'` record'):('are '+numCollisions+' conflicting `'+WLChild.identity+'` records'))+' '+
(numCollisions===1?('is one conflicting '+WLChild.identity+' record'):('are '+numCollisions+' conflicting '+WLChild.identity+' records'))+' '+
'whose `'+schemaDef.via+'` cannot be set to `null`. (That attribute is required.)'
// For example, if you have a car with four tires, and you set out
// to replace the four old tires with only three new ones, then you'll need to
Expand Down

0 comments on commit 069ec38

Please sign in to comment.