assert.js 427 B

12345678910111213141516
  1. function assertHasId(model) {
  2. if (!model.$hasId()) {
  3. const modelClass = model.constructor;
  4. const ids = modelClass.getIdColumnArray().join(', ');
  5. throw new Error(
  6. `one of the identifier columns [${ids}] is null or undefined. Have you specified the correct identifier column for the model '${
  7. modelClass.name
  8. }' using the 'idColumn' property?`
  9. );
  10. }
  11. }
  12. module.exports = {
  13. assertHasId
  14. };