AggregateError.js 891 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.isAggregateError = exports.AggregateError = void 0;
  4. let AggregateErrorImpl;
  5. exports.AggregateError = AggregateErrorImpl;
  6. if (typeof AggregateError === 'undefined') {
  7. class AggregateErrorClass extends Error {
  8. constructor(errors, message = '') {
  9. super(message);
  10. this.errors = errors;
  11. this.name = 'AggregateError';
  12. Error.captureStackTrace(this, AggregateErrorClass);
  13. }
  14. }
  15. exports.AggregateError = AggregateErrorImpl = function (errors, message) {
  16. return new AggregateErrorClass(errors, message);
  17. };
  18. }
  19. else {
  20. exports.AggregateError = AggregateErrorImpl = AggregateError;
  21. }
  22. function isAggregateError(error) {
  23. return 'errors' in error && Array.isArray(error['errors']);
  24. }
  25. exports.isAggregateError = isAggregateError;