UNPKG

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