8647a481f74ceb4abbfcb6ba847f139090dba16a0ceb147a83751099c2434523be87a1bd6e5b926375544e39760ecc445d2b99db513d51e97cb3960dd94b98 972 B

123456789101112131415161718192021222324252627282930
  1. import { createErrorClass } from './createErrorClass';
  2. export interface UnsubscriptionError extends Error {
  3. readonly errors: any[];
  4. }
  5. export interface UnsubscriptionErrorCtor {
  6. /**
  7. * @deprecated Internal implementation detail. Do not construct error instances.
  8. * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
  9. */
  10. new (errors: any[]): UnsubscriptionError;
  11. }
  12. /**
  13. * An error thrown when one or more errors have occurred during the
  14. * `unsubscribe` of a {@link Subscription}.
  15. */
  16. export const UnsubscriptionError: UnsubscriptionErrorCtor = createErrorClass(
  17. (_super) =>
  18. function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {
  19. _super(this);
  20. this.message = errors
  21. ? `${errors.length} errors occurred during unsubscription:
  22. ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}`
  23. : '';
  24. this.name = 'UnsubscriptionError';
  25. this.errors = errors;
  26. }
  27. );