Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

UnsubscriptionError.ts 875B

1234567891011121314151617181920212223242526272829
  1. export interface UnsubscriptionError extends Error {
  2. readonly errors: any[];
  3. }
  4. export interface UnsubscriptionErrorCtor {
  5. new(errors: any[]): UnsubscriptionError;
  6. }
  7. const UnsubscriptionErrorImpl = (() => {
  8. function UnsubscriptionErrorImpl(this: any, errors: any[]) {
  9. Error.call(this);
  10. this.message = errors ?
  11. `${errors.length} errors occurred during unsubscription:
  12. ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}` : '';
  13. this.name = 'UnsubscriptionError';
  14. this.errors = errors;
  15. return this;
  16. }
  17. UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype);
  18. return UnsubscriptionErrorImpl;
  19. })();
  20. /**
  21. * An error thrown when one or more errors have occurred during the
  22. * `unsubscribe` of a {@link Subscription}.
  23. */
  24. export const UnsubscriptionError: UnsubscriptionErrorCtor = UnsubscriptionErrorImpl as any;