1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | export = createHttpError;
|
9 |
|
10 | declare const createHttpError: createHttpError.CreateHttpError & createHttpError.NamedConstructors & {
|
11 | isHttpError: createHttpError.IsHttpError
|
12 | };
|
13 |
|
14 | declare namespace createHttpError {
|
15 | interface HttpError extends Error {
|
16 | status: number;
|
17 | statusCode: number;
|
18 | expose: boolean;
|
19 | headers?: {
|
20 | [key: string]: string;
|
21 | };
|
22 | [key: string]: any;
|
23 | }
|
24 |
|
25 | type UnknownError = Error | string | number | { [key: string]: any };
|
26 |
|
27 | type HttpErrorConstructor = new (msg?: string) => HttpError;
|
28 |
|
29 | type CreateHttpError = (...args: UnknownError[]) => HttpError;
|
30 |
|
31 | type IsHttpError = (error: unknown) => error is HttpError;
|
32 |
|
33 | type NamedConstructors = {
|
34 | [code: string]: HttpErrorConstructor;
|
35 | HttpError: HttpErrorConstructor;
|
36 | } & Record<'BadRequest' |
|
37 | 'Unauthorized' |
|
38 | 'PaymentRequired' |
|
39 | 'Forbidden' |
|
40 | 'NotFound' |
|
41 | 'MethodNotAllowed' |
|
42 | 'NotAcceptable' |
|
43 | 'ProxyAuthenticationRequired' |
|
44 | 'RequestTimeout' |
|
45 | 'Conflict' |
|
46 | 'Gone' |
|
47 | 'LengthRequired' |
|
48 | 'PreconditionFailed' |
|
49 | 'PayloadTooLarge' |
|
50 | 'URITooLong' |
|
51 | 'UnsupportedMediaType' |
|
52 | 'RangeNotSatisfiable' |
|
53 | 'ExpectationFailed' |
|
54 | 'ImATeapot' |
|
55 | 'MisdirectedRequest' |
|
56 | 'UnprocessableEntity' |
|
57 | 'Locked' |
|
58 | 'FailedDependency' |
|
59 | 'UnorderedCollection' |
|
60 | 'UpgradeRequired' |
|
61 | 'PreconditionRequired' |
|
62 | 'TooManyRequests' |
|
63 | 'RequestHeaderFieldsTooLarge' |
|
64 | 'UnavailableForLegalReasons' |
|
65 | 'InternalServerError' |
|
66 | 'NotImplemented' |
|
67 | 'BadGateway' |
|
68 | 'ServiceUnavailable' |
|
69 | 'GatewayTimeout' |
|
70 | 'HTTPVersionNotSupported' |
|
71 | 'VariantAlsoNegotiates' |
|
72 | 'InsufficientStorage' |
|
73 | 'LoopDetected' |
|
74 | 'BandwidthLimitExceeded' |
|
75 | 'NotExtended' |
|
76 | 'NetworkAuthenticationRequire' |
|
77 | '400' |
|
78 | '401' |
|
79 | '402' |
|
80 | '403' |
|
81 | '404' |
|
82 | '405' |
|
83 | '406' |
|
84 | '407' |
|
85 | '408' |
|
86 | '409' |
|
87 | '410' |
|
88 | '411' |
|
89 | '412' |
|
90 | '413' |
|
91 | '414' |
|
92 | '415' |
|
93 | '416' |
|
94 | '417' |
|
95 | '418' |
|
96 | '421' |
|
97 | '422' |
|
98 | '423' |
|
99 | '424' |
|
100 | '425' |
|
101 | '426' |
|
102 | '428' |
|
103 | '429' |
|
104 | '431' |
|
105 | '451' |
|
106 | '500' |
|
107 | '501' |
|
108 | '502' |
|
109 | '503' |
|
110 | '504' |
|
111 | '505' |
|
112 | '506' |
|
113 | '507' |
|
114 | '508' |
|
115 | '509' |
|
116 | '510' |
|
117 | '511', HttpErrorConstructor>;
|
118 | }
|