API Reference Source

lib/errors/bulk-record-error.js

  1. 'use strict';
  2.  
  3. const BaseError = require('./base-error');
  4.  
  5. /**
  6. * Thrown when bulk operation fails, it represent per record level error.
  7. * Used with Promise.AggregateError
  8. *
  9. * @param {Error} error Error for a given record/instance
  10. * @param {Object} record DAO instance that error belongs to
  11. */
  12. class BulkRecordError extends BaseError {
  13. constructor(error, record) {
  14. super(error.message);
  15. this.name = 'SequelizeBulkRecordError';
  16. this.errors = error;
  17. this.record = record;
  18. Error.captureStackTrace(this, this.constructor);
  19. }
  20. }
  21.  
  22. module.exports = BulkRecordError;