ffec754d8d27a2fa1ca13fac30322e450b20bd8ca4f891300894c3219cf6bd5f8ae305380381b5bf89e542632cbca7e1f9c7fd317d0ff855f1a8cc4822a451 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { AjaxRequest } from './types';
  2. /**
  3. * A normalized AJAX error.
  4. *
  5. * @see {@link ajax}
  6. */
  7. export interface AjaxError extends Error {
  8. /**
  9. * The XHR instance associated with the error.
  10. */
  11. xhr: XMLHttpRequest;
  12. /**
  13. * The AjaxRequest associated with the error.
  14. */
  15. request: AjaxRequest;
  16. /**
  17. * The HTTP status code, if the request has completed. If not,
  18. * it is set to `0`.
  19. */
  20. status: number;
  21. /**
  22. * The responseType (e.g. 'json', 'arraybuffer', or 'xml').
  23. */
  24. responseType: XMLHttpRequestResponseType;
  25. /**
  26. * The response data.
  27. */
  28. response: any;
  29. }
  30. export interface AjaxErrorCtor {
  31. /**
  32. * @deprecated Internal implementation detail. Do not construct error instances.
  33. * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
  34. */
  35. new (message: string, xhr: XMLHttpRequest, request: AjaxRequest): AjaxError;
  36. }
  37. /**
  38. * Thrown when an error occurs during an AJAX request.
  39. * This is only exported because it is useful for checking to see if an error
  40. * is an `instanceof AjaxError`. DO NOT create new instances of `AjaxError` with
  41. * the constructor.
  42. *
  43. * @see {@link ajax}
  44. */
  45. export declare const AjaxError: AjaxErrorCtor;
  46. export interface AjaxTimeoutError extends AjaxError {
  47. }
  48. export interface AjaxTimeoutErrorCtor {
  49. /**
  50. * @deprecated Internal implementation detail. Do not construct error instances.
  51. * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269
  52. */
  53. new (xhr: XMLHttpRequest, request: AjaxRequest): AjaxTimeoutError;
  54. }
  55. /**
  56. * Thrown when an AJAX request times out. Not to be confused with {@link TimeoutError}.
  57. *
  58. * This is exported only because it is useful for checking to see if errors are an
  59. * `instanceof AjaxTimeoutError`. DO NOT use the constructor to create an instance of
  60. * this type.
  61. *
  62. * @see {@link ajax}
  63. */
  64. export declare const AjaxTimeoutError: AjaxTimeoutErrorCtor;
  65. //# sourceMappingURL=errors.d.ts.map