foreign-key-constraint-error.js 690 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const DatabaseError = require('./../database-error');
  3. /**
  4. * Thrown when a foreign key constraint is violated in the database
  5. */
  6. class ForeignKeyConstraintError extends DatabaseError {
  7. constructor(options) {
  8. options = options || {};
  9. options.parent = options.parent || { sql: '' };
  10. super(options.parent);
  11. this.name = 'SequelizeForeignKeyConstraintError';
  12. this.message = options.message || options.parent.message || 'Database Error';
  13. this.fields = options.fields;
  14. this.table = options.table;
  15. this.value = options.value;
  16. this.index = options.index;
  17. this.reltype = options.reltype;
  18. }
  19. }
  20. module.exports = ForeignKeyConstraintError;