@web-ts-toolkit/http-errors 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,187 @@
1
+ type HttpErrorMetadataValue = string | number | boolean | bigint | null | undefined;
2
+ type HttpErrorOptions = ErrorOptions & {
3
+ status?: string;
4
+ reason?: string;
5
+ domain?: string;
6
+ metadata?: Record<string, HttpErrorMetadataValue>;
7
+ details?: unknown[];
8
+ errors?: unknown;
9
+ };
10
+ type HttpErrorShape = {
11
+ statusCode: number;
12
+ status?: string;
13
+ message: string;
14
+ reason?: string;
15
+ domain?: string;
16
+ metadata?: Record<string, string>;
17
+ details?: unknown[];
18
+ errors?: unknown;
19
+ };
20
+ type Aip193ErrorInfoDetail = {
21
+ type: 'error_info';
22
+ reason: string;
23
+ domain: string;
24
+ metadata?: Record<string, string>;
25
+ };
26
+ type Aip193ErrorPayload = {
27
+ error: {
28
+ code: number;
29
+ status: string;
30
+ message: string;
31
+ details?: unknown[];
32
+ };
33
+ };
34
+
35
+ declare const canonicalStatusByHttpStatus: {
36
+ readonly 400: "INVALID_ARGUMENT";
37
+ readonly 401: "UNAUTHENTICATED";
38
+ readonly 403: "PERMISSION_DENIED";
39
+ readonly 404: "NOT_FOUND";
40
+ readonly 409: "ABORTED";
41
+ readonly 412: "FAILED_PRECONDITION";
42
+ readonly 429: "RESOURCE_EXHAUSTED";
43
+ readonly 500: "INTERNAL";
44
+ readonly 501: "UNIMPLEMENTED";
45
+ readonly 503: "UNAVAILABLE";
46
+ readonly 504: "DEADLINE_EXCEEDED";
47
+ };
48
+ declare const getCanonicalStatus: (statusCode: number) => string;
49
+
50
+ declare const createAip193ErrorInfoDetail: (reason: string, domain: string, metadata?: Record<string, string>) => Aip193ErrorInfoDetail;
51
+ declare const toAip193ErrorPayload: (error: HttpErrorShape, fallbackDomain?: string) => Aip193ErrorPayload;
52
+
53
+ declare class HttpError extends Error {
54
+ readonly statusCode: number;
55
+ readonly status: string;
56
+ readonly date: Date;
57
+ readonly reason?: string;
58
+ readonly domain?: string;
59
+ readonly metadata?: Record<string, string>;
60
+ readonly details?: unknown[];
61
+ readonly errors?: unknown;
62
+ constructor(statusCode?: number, message?: string, options?: HttpErrorOptions);
63
+ }
64
+ declare class ClientError extends HttpError {
65
+ constructor(statusCode?: number, message?: string, options?: HttpErrorOptions);
66
+ }
67
+ declare class ServerError extends HttpError {
68
+ constructor(statusCode?: number, message?: string, options?: HttpErrorOptions);
69
+ }
70
+
71
+ declare class BadRequestError extends ClientError {
72
+ constructor(message?: string, options?: HttpErrorOptions);
73
+ }
74
+ declare class UnauthorizedError extends ClientError {
75
+ constructor(message?: string, options?: HttpErrorOptions);
76
+ }
77
+ declare class ForbiddenError extends ClientError {
78
+ constructor(message?: string, options?: HttpErrorOptions);
79
+ }
80
+ declare class NotFoundError extends ClientError {
81
+ constructor(message?: string, options?: HttpErrorOptions);
82
+ }
83
+ declare class MethodNotAllowedError extends ClientError {
84
+ constructor(message?: string, options?: HttpErrorOptions);
85
+ }
86
+ declare class NotAcceptableError extends ClientError {
87
+ constructor(message?: string, options?: HttpErrorOptions);
88
+ }
89
+ declare class ProxyAuthRequiredError extends ClientError {
90
+ constructor(message?: string, options?: HttpErrorOptions);
91
+ }
92
+ declare class RequestTimeoutError extends ClientError {
93
+ constructor(message?: string, options?: HttpErrorOptions);
94
+ }
95
+ declare class ConflictError extends ClientError {
96
+ constructor(message?: string, options?: HttpErrorOptions);
97
+ }
98
+ declare class GoneError extends ClientError {
99
+ constructor(message?: string, options?: HttpErrorOptions);
100
+ }
101
+ declare class LengthRequiredError extends ClientError {
102
+ constructor(message?: string, options?: HttpErrorOptions);
103
+ }
104
+ declare class PreconditionFailedError extends ClientError {
105
+ constructor(message?: string, options?: HttpErrorOptions);
106
+ }
107
+ declare class PayloadTooLargeError extends ClientError {
108
+ constructor(message?: string, options?: HttpErrorOptions);
109
+ }
110
+ declare class UriTooLongError extends ClientError {
111
+ constructor(message?: string, options?: HttpErrorOptions);
112
+ }
113
+ declare class UnsupportedMediaTypeError extends ClientError {
114
+ constructor(message?: string, options?: HttpErrorOptions);
115
+ }
116
+ declare class RequestedRangeNotSatisfiableError extends ClientError {
117
+ constructor(message?: string, options?: HttpErrorOptions);
118
+ }
119
+ declare class ExpectationFailedError extends ClientError {
120
+ constructor(message?: string, options?: HttpErrorOptions);
121
+ }
122
+ declare class TeapotError extends ClientError {
123
+ constructor(message?: string, options?: HttpErrorOptions);
124
+ }
125
+ declare class MisdirectedRequestError extends ClientError {
126
+ constructor(message?: string, options?: HttpErrorOptions);
127
+ }
128
+ declare class UnprocessableEntityError extends ClientError {
129
+ constructor(message?: string, options?: HttpErrorOptions);
130
+ }
131
+ declare class LockedError extends ClientError {
132
+ constructor(message?: string, options?: HttpErrorOptions);
133
+ }
134
+ declare class FailedDependencyError extends ClientError {
135
+ constructor(message?: string, options?: HttpErrorOptions);
136
+ }
137
+ declare class UpgradeRequiredError extends ClientError {
138
+ constructor(message?: string, options?: HttpErrorOptions);
139
+ }
140
+ declare class PreconditionRequiredError extends ClientError {
141
+ constructor(message?: string, options?: HttpErrorOptions);
142
+ }
143
+ declare class TooManyRequestsError extends ClientError {
144
+ constructor(message?: string, options?: HttpErrorOptions);
145
+ }
146
+ declare class RequestHeaderFieldsTooLargeError extends ClientError {
147
+ constructor(message?: string, options?: HttpErrorOptions);
148
+ }
149
+ declare class UnavailableForLegalReasonsError extends ClientError {
150
+ constructor(message?: string, options?: HttpErrorOptions);
151
+ }
152
+
153
+ declare class InternalServerError extends ServerError {
154
+ constructor(message?: string, options?: HttpErrorOptions);
155
+ }
156
+ declare class NotImplementedError extends ServerError {
157
+ constructor(message?: string, options?: HttpErrorOptions);
158
+ }
159
+ declare class BadGatewayError extends ServerError {
160
+ constructor(message?: string, options?: HttpErrorOptions);
161
+ }
162
+ declare class ServiceUnavailableError extends ServerError {
163
+ constructor(message?: string, options?: HttpErrorOptions);
164
+ }
165
+ declare class GatewayTimeoutError extends ServerError {
166
+ constructor(message?: string, options?: HttpErrorOptions);
167
+ }
168
+ declare class HttpVersionNotSupportedError extends ServerError {
169
+ constructor(message?: string, options?: HttpErrorOptions);
170
+ }
171
+ declare class VariantAlsoNegotiatesError extends ServerError {
172
+ constructor(message?: string, options?: HttpErrorOptions);
173
+ }
174
+ declare class InsufficientStorageError extends ServerError {
175
+ constructor(message?: string, options?: HttpErrorOptions);
176
+ }
177
+ declare class LoopDetectedError extends ServerError {
178
+ constructor(message?: string, options?: HttpErrorOptions);
179
+ }
180
+ declare class NotExtendedError extends ServerError {
181
+ constructor(message?: string, options?: HttpErrorOptions);
182
+ }
183
+ declare class NetworkAuthenticationRequiredError extends ServerError {
184
+ constructor(message?: string, options?: HttpErrorOptions);
185
+ }
186
+
187
+ export { type Aip193ErrorInfoDetail, type Aip193ErrorPayload, BadGatewayError, BadRequestError, ClientError, ConflictError, ExpectationFailedError, FailedDependencyError, ForbiddenError, GatewayTimeoutError, GoneError, HttpError, type HttpErrorMetadataValue, type HttpErrorOptions, type HttpErrorShape, HttpVersionNotSupportedError, InsufficientStorageError, InternalServerError, LengthRequiredError, LockedError, LoopDetectedError, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, PayloadTooLargeError, PreconditionFailedError, PreconditionRequiredError, ProxyAuthRequiredError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, RequestedRangeNotSatisfiableError, ServerError, ServiceUnavailableError, TeapotError, TooManyRequestsError, UnauthorizedError, UnavailableForLegalReasonsError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, UriTooLongError, VariantAlsoNegotiatesError, canonicalStatusByHttpStatus, createAip193ErrorInfoDetail, getCanonicalStatus, toAip193ErrorPayload };
package/index.js ADDED
@@ -0,0 +1,443 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ BadGatewayError: () => BadGatewayError,
24
+ BadRequestError: () => BadRequestError,
25
+ ClientError: () => ClientError,
26
+ ConflictError: () => ConflictError,
27
+ ExpectationFailedError: () => ExpectationFailedError,
28
+ FailedDependencyError: () => FailedDependencyError,
29
+ ForbiddenError: () => ForbiddenError,
30
+ GatewayTimeoutError: () => GatewayTimeoutError,
31
+ GoneError: () => GoneError,
32
+ HttpError: () => HttpError,
33
+ HttpVersionNotSupportedError: () => HttpVersionNotSupportedError,
34
+ InsufficientStorageError: () => InsufficientStorageError,
35
+ InternalServerError: () => InternalServerError,
36
+ LengthRequiredError: () => LengthRequiredError,
37
+ LockedError: () => LockedError,
38
+ LoopDetectedError: () => LoopDetectedError,
39
+ MethodNotAllowedError: () => MethodNotAllowedError,
40
+ MisdirectedRequestError: () => MisdirectedRequestError,
41
+ NetworkAuthenticationRequiredError: () => NetworkAuthenticationRequiredError,
42
+ NotAcceptableError: () => NotAcceptableError,
43
+ NotExtendedError: () => NotExtendedError,
44
+ NotFoundError: () => NotFoundError,
45
+ NotImplementedError: () => NotImplementedError,
46
+ PayloadTooLargeError: () => PayloadTooLargeError,
47
+ PreconditionFailedError: () => PreconditionFailedError,
48
+ PreconditionRequiredError: () => PreconditionRequiredError,
49
+ ProxyAuthRequiredError: () => ProxyAuthRequiredError,
50
+ RequestHeaderFieldsTooLargeError: () => RequestHeaderFieldsTooLargeError,
51
+ RequestTimeoutError: () => RequestTimeoutError,
52
+ RequestedRangeNotSatisfiableError: () => RequestedRangeNotSatisfiableError,
53
+ ServerError: () => ServerError,
54
+ ServiceUnavailableError: () => ServiceUnavailableError,
55
+ TeapotError: () => TeapotError,
56
+ TooManyRequestsError: () => TooManyRequestsError,
57
+ UnauthorizedError: () => UnauthorizedError,
58
+ UnavailableForLegalReasonsError: () => UnavailableForLegalReasonsError,
59
+ UnprocessableEntityError: () => UnprocessableEntityError,
60
+ UnsupportedMediaTypeError: () => UnsupportedMediaTypeError,
61
+ UpgradeRequiredError: () => UpgradeRequiredError,
62
+ UriTooLongError: () => UriTooLongError,
63
+ VariantAlsoNegotiatesError: () => VariantAlsoNegotiatesError,
64
+ canonicalStatusByHttpStatus: () => canonicalStatusByHttpStatus,
65
+ createAip193ErrorInfoDetail: () => createAip193ErrorInfoDetail,
66
+ getCanonicalStatus: () => getCanonicalStatus,
67
+ toAip193ErrorPayload: () => toAip193ErrorPayload
68
+ });
69
+ module.exports = __toCommonJS(index_exports);
70
+
71
+ // src/status.ts
72
+ var canonicalStatusByHttpStatus = {
73
+ 400: "INVALID_ARGUMENT",
74
+ 401: "UNAUTHENTICATED",
75
+ 403: "PERMISSION_DENIED",
76
+ 404: "NOT_FOUND",
77
+ 409: "ABORTED",
78
+ 412: "FAILED_PRECONDITION",
79
+ 429: "RESOURCE_EXHAUSTED",
80
+ 500: "INTERNAL",
81
+ 501: "UNIMPLEMENTED",
82
+ 503: "UNAVAILABLE",
83
+ 504: "DEADLINE_EXCEEDED"
84
+ };
85
+ var getCanonicalStatus = (statusCode) => canonicalStatusByHttpStatus[statusCode] || "UNKNOWN";
86
+
87
+ // src/serialize.ts
88
+ var createAip193ErrorInfoDetail = (reason, domain, metadata) => ({
89
+ type: "error_info",
90
+ reason,
91
+ domain,
92
+ ...metadata ? { metadata } : {}
93
+ });
94
+ var toAip193ErrorPayload = (error, fallbackDomain = "http-errors") => {
95
+ const status = error.status || getCanonicalStatus(error.statusCode);
96
+ const details = [
97
+ createAip193ErrorInfoDetail(error.reason || status, error.domain || fallbackDomain, error.metadata),
98
+ ...error.errors !== void 0 ? [{ type: "bad_request", errors: error.errors }] : [],
99
+ ...error.details || []
100
+ ];
101
+ return {
102
+ error: {
103
+ code: error.statusCode,
104
+ status,
105
+ message: error.message,
106
+ ...details.length > 0 ? { details } : {}
107
+ }
108
+ };
109
+ };
110
+
111
+ // src/messages.ts
112
+ var messages = {
113
+ 400: "The server cannot process the request due to a client error",
114
+ 401: "The user is not authorized",
115
+ 403: "The server refused to authorize the request",
116
+ 404: "The server did not find a current representation for the target resource",
117
+ 405: "The method received is not allowed",
118
+ 406: "The request is not acceptable to the user agent",
119
+ 407: "The client needs to authenticate itself in order to use a proxy",
120
+ 408: "The request was not completed in the expected time",
121
+ 409: "The request was not completed due to a conflict with the target resource",
122
+ 410: "The target resource is no longer available at the origin server",
123
+ 411: "The server refuses to accept the request without a defined Content-Length",
124
+ 412: "One or more conditions given in the request header fields evaluated to false",
125
+ 413: "The request payload is too large",
126
+ 414: "The request target is too long",
127
+ 415: "The payload is in a format not supported",
128
+ 416: "None of the ranges in the request's Range header field overlap the current extent of the selected resource",
129
+ 417: "The expectation given in the request's Expect header field could not be met",
130
+ 418: "I'm a teapot",
131
+ 421: "The request was directed at a server that is not able to produce a response",
132
+ 422: "The server is unable to process the request",
133
+ 423: "The source or destination resource of a method is locked",
134
+ 424: "The requested action depended on another action",
135
+ 426: "This service requires use of a different protocol",
136
+ 428: "This request is required to be conditional",
137
+ 429: "The user has sent too many requests in a given amount of time",
138
+ 431: "Request header fields too large",
139
+ 451: "Denied access due to a consequence of a legal demand",
140
+ 500: "The server encountered an unexpected condition",
141
+ 501: "The server does not support the functionality required to fulfill the request",
142
+ 502: "The server received an invalid response from an upstream server",
143
+ 503: "The server is temporarily unable to handle the request",
144
+ 504: "The server did not receive a timely response from an upstream server",
145
+ 505: "The server does not support the HTTP protocol version used in the request",
146
+ 506: "The server has an internal configuration error",
147
+ 507: "The server is unable to store the representation needed to complete the request",
148
+ 508: "The server detected an infinite loop while processing the request",
149
+ 510: "Further extensions to the request are required for the server to fulfill it",
150
+ 511: "The client needs to authenticate to gain network access"
151
+ };
152
+ var getDefaultMessage = (statusCode) => messages[statusCode] || messages[500];
153
+
154
+ // src/base.ts
155
+ var ErrorCtor = Error;
156
+ var toMetadata = (metadata) => {
157
+ if (!metadata) {
158
+ return void 0;
159
+ }
160
+ return Object.entries(metadata).reduce((result, [key, value]) => {
161
+ result[key] = String(value);
162
+ return result;
163
+ }, {});
164
+ };
165
+ var HttpError = class extends Error {
166
+ constructor(statusCode = 500, message, options = {}) {
167
+ super(message || getDefaultMessage(statusCode), options);
168
+ if (ErrorCtor.captureStackTrace) {
169
+ ErrorCtor.captureStackTrace(this, this.constructor);
170
+ }
171
+ this.name = this.constructor.name;
172
+ this.statusCode = statusCode;
173
+ this.status = options.status || getCanonicalStatus(statusCode);
174
+ this.date = /* @__PURE__ */ new Date();
175
+ if (options.reason) {
176
+ this.reason = options.reason;
177
+ }
178
+ if (options.domain) {
179
+ this.domain = options.domain;
180
+ }
181
+ if (options.metadata) {
182
+ this.metadata = toMetadata(options.metadata);
183
+ }
184
+ if (options.details) {
185
+ this.details = options.details;
186
+ }
187
+ if (options.errors !== void 0) {
188
+ this.errors = options.errors;
189
+ }
190
+ }
191
+ };
192
+ var ClientError = class extends HttpError {
193
+ constructor(statusCode = 400, message, options = {}) {
194
+ super(statusCode, message, options);
195
+ }
196
+ };
197
+ var ServerError = class extends HttpError {
198
+ constructor(statusCode = 500, message, options = {}) {
199
+ super(statusCode, message, options);
200
+ }
201
+ };
202
+
203
+ // src/client-errors.ts
204
+ var BadRequestError = class extends ClientError {
205
+ constructor(message, options = {}) {
206
+ super(400, message, options);
207
+ }
208
+ };
209
+ var UnauthorizedError = class extends ClientError {
210
+ constructor(message, options = {}) {
211
+ super(401, message, options);
212
+ }
213
+ };
214
+ var ForbiddenError = class extends ClientError {
215
+ constructor(message, options = {}) {
216
+ super(403, message, options);
217
+ }
218
+ };
219
+ var NotFoundError = class extends ClientError {
220
+ constructor(message, options = {}) {
221
+ super(404, message, options);
222
+ }
223
+ };
224
+ var MethodNotAllowedError = class extends ClientError {
225
+ constructor(message, options = {}) {
226
+ super(405, message, options);
227
+ }
228
+ };
229
+ var NotAcceptableError = class extends ClientError {
230
+ constructor(message, options = {}) {
231
+ super(406, message, options);
232
+ }
233
+ };
234
+ var ProxyAuthRequiredError = class extends ClientError {
235
+ constructor(message, options = {}) {
236
+ super(407, message, options);
237
+ }
238
+ };
239
+ var RequestTimeoutError = class extends ClientError {
240
+ constructor(message, options = {}) {
241
+ super(408, message, options);
242
+ }
243
+ };
244
+ var ConflictError = class extends ClientError {
245
+ constructor(message, options = {}) {
246
+ super(409, message, options);
247
+ }
248
+ };
249
+ var GoneError = class extends ClientError {
250
+ constructor(message, options = {}) {
251
+ super(410, message, options);
252
+ }
253
+ };
254
+ var LengthRequiredError = class extends ClientError {
255
+ constructor(message, options = {}) {
256
+ super(411, message, options);
257
+ }
258
+ };
259
+ var PreconditionFailedError = class extends ClientError {
260
+ constructor(message, options = {}) {
261
+ super(412, message, options);
262
+ }
263
+ };
264
+ var PayloadTooLargeError = class extends ClientError {
265
+ constructor(message, options = {}) {
266
+ super(413, message, options);
267
+ }
268
+ };
269
+ var UriTooLongError = class extends ClientError {
270
+ constructor(message, options = {}) {
271
+ super(414, message, options);
272
+ }
273
+ };
274
+ var UnsupportedMediaTypeError = class extends ClientError {
275
+ constructor(message, options = {}) {
276
+ super(415, message, options);
277
+ }
278
+ };
279
+ var RequestedRangeNotSatisfiableError = class extends ClientError {
280
+ constructor(message, options = {}) {
281
+ super(416, message, options);
282
+ }
283
+ };
284
+ var ExpectationFailedError = class extends ClientError {
285
+ constructor(message, options = {}) {
286
+ super(417, message, options);
287
+ }
288
+ };
289
+ var TeapotError = class extends ClientError {
290
+ constructor(message, options = {}) {
291
+ super(418, message, options);
292
+ }
293
+ };
294
+ var MisdirectedRequestError = class extends ClientError {
295
+ constructor(message, options = {}) {
296
+ super(421, message, options);
297
+ }
298
+ };
299
+ var UnprocessableEntityError = class extends ClientError {
300
+ constructor(message, options = {}) {
301
+ super(422, message, options);
302
+ }
303
+ };
304
+ var LockedError = class extends ClientError {
305
+ constructor(message, options = {}) {
306
+ super(423, message, options);
307
+ }
308
+ };
309
+ var FailedDependencyError = class extends ClientError {
310
+ constructor(message, options = {}) {
311
+ super(424, message, options);
312
+ }
313
+ };
314
+ var UpgradeRequiredError = class extends ClientError {
315
+ constructor(message, options = {}) {
316
+ super(426, message, options);
317
+ }
318
+ };
319
+ var PreconditionRequiredError = class extends ClientError {
320
+ constructor(message, options = {}) {
321
+ super(428, message, options);
322
+ }
323
+ };
324
+ var TooManyRequestsError = class extends ClientError {
325
+ constructor(message, options = {}) {
326
+ super(429, message, options);
327
+ }
328
+ };
329
+ var RequestHeaderFieldsTooLargeError = class extends ClientError {
330
+ constructor(message, options = {}) {
331
+ super(431, message, options);
332
+ }
333
+ };
334
+ var UnavailableForLegalReasonsError = class extends ClientError {
335
+ constructor(message, options = {}) {
336
+ super(451, message, options);
337
+ }
338
+ };
339
+
340
+ // src/server-errors.ts
341
+ var InternalServerError = class extends ServerError {
342
+ constructor(message, options = {}) {
343
+ super(500, message, options);
344
+ }
345
+ };
346
+ var NotImplementedError = class extends ServerError {
347
+ constructor(message, options = {}) {
348
+ super(501, message, options);
349
+ }
350
+ };
351
+ var BadGatewayError = class extends ServerError {
352
+ constructor(message, options = {}) {
353
+ super(502, message, options);
354
+ }
355
+ };
356
+ var ServiceUnavailableError = class extends ServerError {
357
+ constructor(message, options = {}) {
358
+ super(503, message, options);
359
+ }
360
+ };
361
+ var GatewayTimeoutError = class extends ServerError {
362
+ constructor(message, options = {}) {
363
+ super(504, message, options);
364
+ }
365
+ };
366
+ var HttpVersionNotSupportedError = class extends ServerError {
367
+ constructor(message, options = {}) {
368
+ super(505, message, options);
369
+ }
370
+ };
371
+ var VariantAlsoNegotiatesError = class extends ServerError {
372
+ constructor(message, options = {}) {
373
+ super(506, message, options);
374
+ }
375
+ };
376
+ var InsufficientStorageError = class extends ServerError {
377
+ constructor(message, options = {}) {
378
+ super(507, message, options);
379
+ }
380
+ };
381
+ var LoopDetectedError = class extends ServerError {
382
+ constructor(message, options = {}) {
383
+ super(508, message, options);
384
+ }
385
+ };
386
+ var NotExtendedError = class extends ServerError {
387
+ constructor(message, options = {}) {
388
+ super(510, message, options);
389
+ }
390
+ };
391
+ var NetworkAuthenticationRequiredError = class extends ServerError {
392
+ constructor(message, options = {}) {
393
+ super(511, message, options);
394
+ }
395
+ };
396
+ // Annotate the CommonJS export names for ESM import in node:
397
+ 0 && (module.exports = {
398
+ BadGatewayError,
399
+ BadRequestError,
400
+ ClientError,
401
+ ConflictError,
402
+ ExpectationFailedError,
403
+ FailedDependencyError,
404
+ ForbiddenError,
405
+ GatewayTimeoutError,
406
+ GoneError,
407
+ HttpError,
408
+ HttpVersionNotSupportedError,
409
+ InsufficientStorageError,
410
+ InternalServerError,
411
+ LengthRequiredError,
412
+ LockedError,
413
+ LoopDetectedError,
414
+ MethodNotAllowedError,
415
+ MisdirectedRequestError,
416
+ NetworkAuthenticationRequiredError,
417
+ NotAcceptableError,
418
+ NotExtendedError,
419
+ NotFoundError,
420
+ NotImplementedError,
421
+ PayloadTooLargeError,
422
+ PreconditionFailedError,
423
+ PreconditionRequiredError,
424
+ ProxyAuthRequiredError,
425
+ RequestHeaderFieldsTooLargeError,
426
+ RequestTimeoutError,
427
+ RequestedRangeNotSatisfiableError,
428
+ ServerError,
429
+ ServiceUnavailableError,
430
+ TeapotError,
431
+ TooManyRequestsError,
432
+ UnauthorizedError,
433
+ UnavailableForLegalReasonsError,
434
+ UnprocessableEntityError,
435
+ UnsupportedMediaTypeError,
436
+ UpgradeRequiredError,
437
+ UriTooLongError,
438
+ VariantAlsoNegotiatesError,
439
+ canonicalStatusByHttpStatus,
440
+ createAip193ErrorInfoDetail,
441
+ getCanonicalStatus,
442
+ toAip193ErrorPayload
443
+ });