@bombillazo/error-x 0.3.0 → 0.4.0

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/dist/index.cjs CHANGED
@@ -9,16 +9,6 @@ var safeStringify__default = /*#__PURE__*/_interopDefault(safeStringify);
9
9
  // src/error.ts
10
10
 
11
11
  // src/types.ts
12
- var HandlingTargets = /* @__PURE__ */ ((HandlingTargets2) => {
13
- HandlingTargets2["MODAL"] = "modal";
14
- HandlingTargets2["TOAST"] = "toast";
15
- HandlingTargets2["INLINE"] = "inline";
16
- HandlingTargets2["BANNER"] = "banner";
17
- HandlingTargets2["CONSOLE"] = "console";
18
- HandlingTargets2["LOGGER"] = "logger";
19
- HandlingTargets2["NOTIFICATION"] = "notification";
20
- return HandlingTargets2;
21
- })(HandlingTargets || {});
22
12
  var ERROR_X_OPTION_FIELDS = [
23
13
  "message",
24
14
  "name",
@@ -26,14 +16,18 @@ var ERROR_X_OPTION_FIELDS = [
26
16
  "uiMessage",
27
17
  "cause",
28
18
  "metadata",
29
- "actions",
30
19
  "httpStatus",
31
- "type"
20
+ "type",
21
+ "sourceUrl",
22
+ "docsUrl",
23
+ "source"
32
24
  ];
33
25
 
34
26
  // src/error.ts
35
27
  var acceptedFields = new Set(ERROR_X_OPTION_FIELDS);
36
28
  var ErrorX = class _ErrorX extends Error {
29
+ /** Global configuration for all ErrorX instances */
30
+ static _config = null;
37
31
  /** Error identifier code, auto-generated from name if not provided */
38
32
  code;
39
33
  /** User-friendly message suitable for display in UI */
@@ -42,71 +36,87 @@ var ErrorX = class _ErrorX extends Error {
42
36
  metadata;
43
37
  /** Timestamp when the error was created */
44
38
  timestamp;
45
- /** Error actions for UI behavior and handling */
46
- actions;
47
39
  /** HTTP status code (100-599) for HTTP-related errors */
48
40
  httpStatus;
49
41
  /** Error type for categorization */
50
42
  type;
43
+ /** Source URL related to the error (API endpoint, page URL, resource URL) */
44
+ sourceUrl;
45
+ /** Documentation URL for this specific error */
46
+ docsUrl;
47
+ /** Where the error originated (service name, module, component) */
48
+ source;
51
49
  /**
52
50
  * Creates a new ErrorX instance with enhanced error handling capabilities.
53
51
  *
54
- * @param messageOrOptions - Error message string, ErrorXOptions object, or any value to convert to ErrorX
55
- * @param additionalOptions - Additional options when first parameter is a string (optional)
52
+ * @param messageOrOptions - Error message string or ErrorXOptions object (optional)
56
53
  *
57
54
  * @example
58
55
  * ```typescript
56
+ * // Create with default message
57
+ * const error1 = new ErrorX()
58
+ *
59
59
  * // Create with string message only
60
- * const error1 = new ErrorX('Database query failed')
60
+ * const error2 = new ErrorX('Database query failed')
61
61
  *
62
- * // Create with string message and additional options
63
- * const error2 = new ErrorX('Database query failed', {
62
+ * // Create with options object
63
+ * const error3 = new ErrorX({
64
+ * message: 'Database query failed',
64
65
  * name: 'DatabaseError',
65
66
  * code: 'DB_QUERY_FAILED',
66
67
  * uiMessage: 'Unable to load data. Please try again.',
67
68
  * metadata: { query: 'SELECT * FROM users', timeout: 5000 }
68
69
  * })
69
70
  *
70
- * // Create with options object (backward compatible)
71
- * const error3 = new ErrorX({
72
- * message: 'Database query failed',
73
- * name: 'DatabaseError',
74
- * code: 'DB_QUERY_FAILED',
75
- * actions: [
76
- * { action: 'notify', payload: { targets: [HandlingTargets.TOAST] } }
77
- * ]
71
+ * // With type-safe metadata
72
+ * type MyMeta = { userId: number };
73
+ * const error4 = new ErrorX<MyMeta>({
74
+ * message: 'User action failed',
75
+ * metadata: { userId: 123 }
78
76
  * })
79
77
  *
80
- * // Create with unknown input (smart conversion)
78
+ * // For converting unknown errors, use ErrorX.from()
81
79
  * const apiError = { message: 'User not found', code: 404 }
82
- * const error4 = new ErrorX(apiError)
83
- *
84
- * // Create with no options (uses defaults)
85
- * const error5 = new ErrorX()
80
+ * const error5 = ErrorX.from(apiError)
86
81
  * ```
87
82
  */
88
- constructor(messageOrOptions, additionalOptions) {
83
+ constructor(messageOrOptions) {
89
84
  let options = {};
90
85
  if (typeof messageOrOptions === "string") {
91
- options = {
92
- message: messageOrOptions,
93
- ...additionalOptions
94
- };
95
- } else if (_ErrorX.isErrorXOptions(messageOrOptions)) {
96
- options = messageOrOptions;
86
+ options = { message: messageOrOptions };
97
87
  } else if (messageOrOptions != null) {
98
- options = _ErrorX.convertUnknownToOptions(messageOrOptions);
88
+ options = messageOrOptions;
89
+ }
90
+ const envConfig = _ErrorX.getConfig();
91
+ const message = options.message?.trim() ? options.message : "An error occurred";
92
+ super(message, { cause: options.cause });
93
+ if (options.cause !== void 0 && !Object.hasOwn(this, "cause")) {
94
+ Object.defineProperty(this, "cause", {
95
+ value: options.cause,
96
+ writable: true,
97
+ enumerable: false,
98
+ configurable: true
99
+ });
99
100
  }
100
- const formattedMessage = _ErrorX.formatMessage(options.message);
101
- super(formattedMessage, { cause: options.cause });
102
101
  this.name = options.name ?? _ErrorX.getDefaultName();
103
102
  this.code = options.code != null ? String(options.code) : _ErrorX.generateDefaultCode(options.name);
104
103
  this.uiMessage = options.uiMessage;
105
104
  this.metadata = options.metadata;
106
- this.actions = options.actions;
107
105
  this.httpStatus = _ErrorX.validateHttpStatus(options.httpStatus);
108
106
  this.type = _ErrorX.validateType(options.type);
109
107
  this.timestamp = /* @__PURE__ */ new Date();
108
+ this.sourceUrl = options.sourceUrl;
109
+ this.source = options.source ?? envConfig?.source;
110
+ let generatedDocsUrl;
111
+ if (envConfig?.docsBaseURL && envConfig?.docsMap && this.code) {
112
+ const docPath = envConfig.docsMap[this.code];
113
+ if (docPath) {
114
+ const base = envConfig.docsBaseURL.replace(/\/+$/, "");
115
+ const path = docPath.replace(/^\/+/, "");
116
+ generatedDocsUrl = `${base}/${path}`;
117
+ }
118
+ }
119
+ this.docsUrl = options.docsUrl ?? generatedDocsUrl;
110
120
  if (options.cause instanceof Error) {
111
121
  this.stack = _ErrorX.preserveOriginalStack(options.cause, this);
112
122
  } else {
@@ -123,6 +133,34 @@ var ErrorX = class _ErrorX extends Error {
123
133
  static getDefaultName() {
124
134
  return "Error";
125
135
  }
136
+ /**
137
+ * Configure global ErrorX settings.
138
+ * This method allows you to set defaults for all ErrorX instances.
139
+ *
140
+ * @param config - Configuration object
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * ErrorX.configure({
145
+ * source: 'my-api-service',
146
+ * docsBaseURL: 'https://docs.example.com/errors',
147
+ * docsMap: {
148
+ * 'AUTH_FAILED': 'authentication-errors',
149
+ * 'DB_ERROR': 'database-errors'
150
+ * }
151
+ * })
152
+ * ```
153
+ */
154
+ static configure(config) {
155
+ _ErrorX._config = { ..._ErrorX._config || {}, ...config };
156
+ }
157
+ /**
158
+ * Get the current global configuration.
159
+ * Returns null if no configuration has been set.
160
+ */
161
+ static getConfig() {
162
+ return _ErrorX._config;
163
+ }
126
164
  /**
127
165
  * Validates HTTP status code to ensure it's within valid range (100-599)
128
166
  *
@@ -218,10 +256,24 @@ var ErrorX = class _ErrorX extends Error {
218
256
  */
219
257
  static cleanStack(stack) {
220
258
  if (!stack) return "";
259
+ const config = _ErrorX.getConfig();
260
+ const cleanStackConfig = config?.cleanStack ?? true;
261
+ if (cleanStackConfig === false) {
262
+ return stack;
263
+ }
221
264
  const stackLines = stack.split("\n");
222
265
  const cleanedLines = [];
266
+ const defaultPatterns = [
267
+ "new ErrorX",
268
+ "ErrorX.constructor",
269
+ "ErrorX.from",
270
+ "error-x/dist/",
271
+ "error-x/src/error.ts"
272
+ ];
273
+ const patterns = Array.isArray(cleanStackConfig) ? cleanStackConfig : defaultPatterns;
223
274
  for (const line of stackLines) {
224
- if (line.includes("new ErrorX") || line.includes("ErrorX.constructor") || line.includes("ErrorX.toErrorX") || line.includes("error-x/dist/") || line.includes("error-x/src/error.ts")) {
275
+ const shouldSkip = patterns.some((pattern) => line.includes(pattern));
276
+ if (shouldSkip) {
225
277
  continue;
226
278
  }
227
279
  cleanedLines.push(line);
@@ -251,35 +303,6 @@ var ErrorX = class _ErrorX extends Error {
251
303
  }
252
304
  return stack;
253
305
  }
254
- /**
255
- * Formats error messages with proper capitalization and punctuation.
256
- * Ensures consistent message formatting across all ErrorX instances.
257
- *
258
- * @param message - Raw error message to format (optional)
259
- * @returns Formatted message with proper capitalization and punctuation
260
- *
261
- * @example
262
- * ```typescript
263
- * formatMessage('database connection failed') // 'Database connection failed.'
264
- * formatMessage('user not found. please check credentials') // 'User not found. Please check credentials.'
265
- * formatMessage() // 'An error occurred'
266
- * ```
267
- */
268
- static formatMessage(message) {
269
- if (!message || typeof message !== "string" || !message.trim()) {
270
- return "An error occurred";
271
- }
272
- let formatted = message.split(". ").map((sentence) => {
273
- const trimmed = sentence.trim();
274
- if (!trimmed) return trimmed;
275
- return trimmed.charAt(0).toUpperCase() + trimmed.slice(1);
276
- }).join(". ");
277
- const endsWithPunctuation = /[.!?)\]]$/.test(formatted);
278
- if (!endsWithPunctuation) {
279
- formatted = `${formatted}.`;
280
- }
281
- return formatted;
282
- }
283
306
  /**
284
307
  * Creates a new ErrorX instance with additional metadata merged with existing metadata.
285
308
  * The original error properties are preserved while extending the metadata.
@@ -310,15 +333,16 @@ var ErrorX = class _ErrorX extends Error {
310
333
  cause: this.cause,
311
334
  metadata: { ...this.metadata ?? {}, ...additionalMetadata },
312
335
  httpStatus: this.httpStatus,
313
- type: this.type
336
+ type: this.type,
337
+ sourceUrl: this.sourceUrl,
338
+ docsUrl: this.docsUrl,
339
+ source: this.source
314
340
  };
315
- if (this.actions) {
316
- options.actions = this.actions;
317
- }
318
341
  const newError = new _ErrorX(options);
319
342
  if (this.stack) {
320
343
  newError.stack = this.stack;
321
344
  }
345
+ newError.timestamp = this.timestamp;
322
346
  return newError;
323
347
  }
324
348
  /**
@@ -358,9 +382,11 @@ var ErrorX = class _ErrorX extends Error {
358
382
  let uiMessage = "";
359
383
  let cause;
360
384
  let metadata = {};
361
- let actions;
362
385
  let httpStatus;
363
386
  let type;
387
+ let url;
388
+ let href;
389
+ let source;
364
390
  if (error) {
365
391
  if (typeof error === "string") {
366
392
  message = error;
@@ -383,9 +409,6 @@ var ErrorX = class _ErrorX extends Error {
383
409
  if ("code" in error && error.code) code = String(error.code);
384
410
  if ("uiMessage" in error && error.uiMessage) uiMessage = String(error.uiMessage);
385
411
  else if ("userMessage" in error && error.userMessage) uiMessage = String(error.userMessage);
386
- if ("actions" in error && Array.isArray(error.actions)) {
387
- actions = error.actions;
388
- }
389
412
  let _httpStatus;
390
413
  if ("httpStatus" in error) {
391
414
  _httpStatus = error.httpStatus;
@@ -401,6 +424,25 @@ var ErrorX = class _ErrorX extends Error {
401
424
  if ("type" in error && error.type) {
402
425
  type = _ErrorX.validateType(String(error.type));
403
426
  }
427
+ if ("sourceUrl" in error && error.sourceUrl) {
428
+ url = String(error.sourceUrl);
429
+ } else if ("url" in error && error.url) {
430
+ url = String(error.url);
431
+ }
432
+ if ("docsUrl" in error && error.docsUrl) {
433
+ href = String(error.docsUrl);
434
+ } else if ("href" in error && error.href) {
435
+ href = String(error.href);
436
+ } else if ("documentationUrl" in error && error.documentationUrl) {
437
+ href = String(error.documentationUrl);
438
+ }
439
+ if ("source" in error && error.source) {
440
+ source = String(error.source);
441
+ } else if ("service" in error && error.service) {
442
+ source = String(error.service);
443
+ } else if ("component" in error && error.component) {
444
+ source = String(error.component);
445
+ }
404
446
  metadata = { originalError: error };
405
447
  }
406
448
  }
@@ -412,58 +454,18 @@ var ErrorX = class _ErrorX extends Error {
412
454
  if (uiMessage) options.uiMessage = uiMessage;
413
455
  if (cause) options.cause = cause;
414
456
  if (Object.keys(metadata).length > 0) options.metadata = metadata;
415
- if (actions && actions.length > 0) options.actions = actions;
416
457
  if (httpStatus) options.httpStatus = httpStatus;
417
458
  if (type) options.type = type;
459
+ if (url) options.sourceUrl = url;
460
+ if (href) options.docsUrl = href;
461
+ if (source) options.source = source;
418
462
  return options;
419
463
  }
420
- /**
421
- * Converts unknown input into an ErrorX instance with intelligent property extraction.
422
- * Handles strings, regular Error objects, API response objects, and unknown values.
423
- *
424
- * @param error - Value to convert to ErrorX
425
- * @returns ErrorX instance with extracted properties
426
- *
427
- * @example
428
- * ```typescript
429
- * // Convert string error
430
- * const error1 = ErrorX.toErrorX('Something went wrong')
431
- *
432
- * // Convert regular Error
433
- * const error2 = ErrorX.toErrorX(new Error('Database failed'))
434
- *
435
- * // Convert API response object
436
- * const apiError = {
437
- * message: 'User not found',
438
- * code: 'USER_404',
439
- * statusText: 'Not Found'
440
- * }
441
- * const error3 = ErrorX.toErrorX(apiError)
442
- * ```
443
- */
444
- static toErrorX(error) {
464
+ static from(error) {
445
465
  if (error instanceof _ErrorX) return error;
446
466
  const options = _ErrorX.convertUnknownToOptions(error);
447
467
  return new _ErrorX(options);
448
468
  }
449
- /**
450
- * Public wrapper for processing error stack traces with delimiter.
451
- * Delegates to the private processErrorStack method for implementation.
452
- *
453
- * @param error - Error whose stack to process
454
- * @param delimiter - String to search for in stack lines
455
- * @returns Processed stack trace starting after the delimiter
456
- *
457
- * @example
458
- * ```typescript
459
- * const error = new Error('Something failed')
460
- * const cleanStack = ErrorX.processStack(error, 'my-app-entry')
461
- * // Returns stack trace starting after the line containing 'my-app-entry'
462
- * ```
463
- */
464
- static processStack(error, delimiter) {
465
- return _ErrorX.processErrorStack(error, delimiter);
466
- }
467
469
  /**
468
470
  * Creates a new ErrorX instance with cleaned stack trace using the specified delimiter.
469
471
  * Returns the same instance if no delimiter is provided or no stack is available.
@@ -487,14 +489,14 @@ var ErrorX = class _ErrorX extends Error {
487
489
  uiMessage: this.uiMessage,
488
490
  cause: this.cause,
489
491
  httpStatus: this.httpStatus,
490
- type: this.type
492
+ type: this.type,
493
+ sourceUrl: this.sourceUrl,
494
+ docsUrl: this.docsUrl,
495
+ source: this.source
491
496
  };
492
497
  if (this.metadata !== void 0) {
493
498
  options.metadata = this.metadata;
494
499
  }
495
- if (this.actions) {
496
- options.actions = this.actions;
497
- }
498
500
  const newError = new _ErrorX(options);
499
501
  newError.stack = _ErrorX.processErrorStack(this, delimiter);
500
502
  return newError;
@@ -557,7 +559,10 @@ ${this.stack}`;
557
559
  * ```
558
560
  */
559
561
  toJSON() {
560
- const safeMetadata = this.metadata ? JSON.parse(safeStringify__default.default(this.metadata)) : void 0;
562
+ let safeMetadata;
563
+ if (this.metadata) {
564
+ safeMetadata = JSON.parse(safeStringify__default.default(this.metadata));
565
+ }
561
566
  const serialized = {
562
567
  name: this.name,
563
568
  message: this.message,
@@ -566,35 +571,52 @@ ${this.stack}`;
566
571
  metadata: safeMetadata,
567
572
  timestamp: this.timestamp.toISOString()
568
573
  };
569
- if (this.actions && this.actions.length > 0) {
570
- const stringified = safeStringify__default.default(this.actions);
571
- serialized.actions = JSON.parse(stringified);
572
- }
573
574
  if (this.httpStatus !== void 0) {
574
575
  serialized.httpStatus = this.httpStatus;
575
576
  }
576
577
  if (this.type !== void 0) {
577
578
  serialized.type = this.type;
578
579
  }
580
+ if (this.sourceUrl !== void 0) {
581
+ serialized.sourceUrl = this.sourceUrl;
582
+ }
583
+ if (this.docsUrl !== void 0) {
584
+ serialized.docsUrl = this.docsUrl;
585
+ }
586
+ if (this.source !== void 0) {
587
+ serialized.source = this.source;
588
+ }
579
589
  if (this.stack) {
580
590
  serialized.stack = this.stack;
581
591
  }
582
592
  if (this.cause) {
583
- if (this.cause instanceof _ErrorX) {
584
- serialized.cause = this.cause.toJSON();
585
- } else if (this.cause instanceof Error) {
586
- const causeData = {
587
- name: this.cause.name,
588
- message: this.cause.message,
589
- code: "ERROR",
590
- uiMessage: void 0,
591
- metadata: {},
592
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
593
+ if (this.cause instanceof Error) {
594
+ const cause = {
595
+ message: this.cause.message
593
596
  };
597
+ if (this.cause.name) {
598
+ cause.name = this.cause.name;
599
+ }
594
600
  if (this.cause.stack) {
595
- causeData.stack = this.cause.stack;
601
+ cause.stack = this.cause.stack;
596
602
  }
597
- serialized.cause = causeData;
603
+ serialized.cause = cause;
604
+ } else if (typeof this.cause === "object" && this.cause !== null) {
605
+ const causeObj = this.cause;
606
+ const cause = {
607
+ message: String(causeObj.message || causeObj)
608
+ };
609
+ if (causeObj.name) {
610
+ cause.name = String(causeObj.name);
611
+ }
612
+ if (causeObj.stack) {
613
+ cause.stack = String(causeObj.stack);
614
+ }
615
+ serialized.cause = cause;
616
+ } else {
617
+ serialized.cause = {
618
+ message: String(this.cause)
619
+ };
598
620
  }
599
621
  }
600
622
  return serialized;
@@ -628,469 +650,355 @@ ${this.stack}`;
628
650
  code: serialized.code,
629
651
  uiMessage: serialized.uiMessage,
630
652
  httpStatus: serialized.httpStatus,
631
- type: serialized.type
653
+ type: serialized.type,
654
+ sourceUrl: serialized.sourceUrl,
655
+ docsUrl: serialized.docsUrl,
656
+ source: serialized.source
632
657
  };
633
658
  if (serialized.metadata !== void 0) {
634
659
  options.metadata = serialized.metadata;
635
660
  }
636
- if (serialized.actions && serialized.actions.length > 0) {
637
- options.actions = serialized.actions;
638
- }
639
661
  const error = new _ErrorX(options);
640
662
  if (serialized.stack) {
641
663
  error.stack = serialized.stack;
642
664
  }
643
- Object.defineProperty(error, "timestamp", {
644
- value: new Date(serialized.timestamp),
645
- writable: false
646
- });
665
+ error.timestamp = new Date(serialized.timestamp);
647
666
  if (serialized.cause) {
667
+ const causeError = new Error(serialized.cause.message);
668
+ if (serialized.cause.name) {
669
+ causeError.name = serialized.cause.name;
670
+ }
671
+ if (serialized.cause.stack) {
672
+ causeError.stack = serialized.cause.stack;
673
+ }
648
674
  Object.defineProperty(error, "cause", {
649
- value: _ErrorX.fromJSON(serialized.cause),
650
- writable: false
675
+ value: causeError,
676
+ writable: true
651
677
  });
652
678
  }
653
679
  return error;
654
680
  }
655
- /**
656
- * HTTP error presets for common HTTP status codes.
657
- *
658
- * ## Features
659
- * - **Pre-configured error templates** for common HTTP status codes (400-511)
660
- * - **Type-safe** with TypeScript support
661
- * - **Fully customizable** via destructuring and override pattern
662
- * - **User-friendly messages** included for all presets
663
- * - **Categorized by type** - all HTTP presets include `type: 'http'`
664
- *
665
- * ## Usage Patterns
666
- *
667
- * ### 1. Direct Usage
668
- * Use a preset as-is without any modifications:
669
- * ```typescript
670
- * throw new ErrorX(ErrorX.HTTP.NOT_FOUND)
671
- * // Result: 404 error with default message and UI message
672
- * ```
673
- *
674
- * ### 2. Override Specific Fields
675
- * Customize the error while keeping other preset values:
676
- * ```typescript
677
- * throw new ErrorX({
678
- * ...ErrorX.HTTP.NOT_FOUND,
679
- * message: 'User not found',
680
- * metadata: { userId: 123 }
681
- * })
682
- * // Result: 404 error with custom message but keeps httpStatus, code, name, uiMessage, type
683
- * ```
684
- *
685
- * ### 3. Add Metadata and Actions
686
- * Enhance presets with additional context and behaviors:
687
- * ```typescript
688
- * throw new ErrorX({
689
- * ...ErrorX.HTTP.UNAUTHORIZED,
690
- * metadata: { attemptedAction: 'viewProfile', userId: 456 },
691
- * actions: [
692
- * { action: 'logout', payload: { clearStorage: true } },
693
- * { action: 'redirect', payload: { redirectURL: '/login' } }
694
- * ]
695
- * })
696
- * ```
697
- *
698
- * ### 4. Add Error Cause
699
- * Chain errors by adding a cause:
700
- * ```typescript
701
- * try {
702
- * // some operation
703
- * } catch (originalError) {
704
- * throw new ErrorX({
705
- * ...ErrorX.HTTP.INTERNAL_SERVER_ERROR,
706
- * cause: originalError,
707
- * metadata: { operation: 'database-query' }
708
- * })
709
- * }
710
- * ```
711
- *
712
- * ## Common HTTP Presets
713
- *
714
- * ### 4xx Client Errors
715
- * - `BAD_REQUEST` (400) - Invalid request data
716
- * - `UNAUTHORIZED` (401) - Authentication required
717
- * - `FORBIDDEN` (403) - Insufficient permissions
718
- * - `NOT_FOUND` (404) - Resource not found
719
- * - `METHOD_NOT_ALLOWED` (405) - HTTP method not allowed
720
- * - `CONFLICT` (409) - Resource conflict
721
- * - `UNPROCESSABLE_ENTITY` (422) - Validation failed
722
- * - `TOO_MANY_REQUESTS` (429) - Rate limit exceeded
723
- *
724
- * ### 5xx Server Errors
725
- * - `INTERNAL_SERVER_ERROR` (500) - Unexpected server error
726
- * - `NOT_IMPLEMENTED` (501) - Feature not implemented
727
- * - `BAD_GATEWAY` (502) - Upstream server error
728
- * - `SERVICE_UNAVAILABLE` (503) - Service temporarily down
729
- * - `GATEWAY_TIMEOUT` (504) - Upstream timeout
730
- *
731
- * @example
732
- * ```typescript
733
- * // API endpoint example
734
- * app.get('/users/:id', async (req, res) => {
735
- * const user = await db.users.findById(req.params.id)
736
- *
737
- * if (!user) {
738
- * throw new ErrorX({
739
- * ...ErrorX.HTTP.NOT_FOUND,
740
- * message: 'User not found',
741
- * metadata: { userId: req.params.id }
742
- * })
743
- * }
744
- *
745
- * res.json(user)
746
- * })
747
- *
748
- * // Authentication middleware example
749
- * const requireAuth = (req, res, next) => {
750
- * if (!req.user) {
751
- * throw new ErrorX({
752
- * ...ErrorX.HTTP.UNAUTHORIZED,
753
- * actions: [
754
- * { action: 'redirect', payload: { redirectURL: '/login' } }
755
- * ]
756
- * })
757
- * }
758
- * next()
759
- * }
760
- *
761
- * // Rate limiting example
762
- * if (isRateLimited(req.ip)) {
763
- * throw new ErrorX({
764
- * ...ErrorX.HTTP.TOO_MANY_REQUESTS,
765
- * metadata: {
766
- * ip: req.ip,
767
- * retryAfter: 60
768
- * }
769
- * })
770
- * }
771
- * ```
772
- *
773
- * @public
774
- */
775
- static HTTP = {
776
- // 4xx Client Errors
777
- BAD_REQUEST: {
778
- httpStatus: 400,
779
- code: "BAD_REQUEST",
780
- name: "Bad Request Error",
781
- message: "bad request",
782
- uiMessage: "The request could not be processed. Please check your input and try again.",
783
- type: "http"
784
- },
785
- UNAUTHORIZED: {
786
- httpStatus: 401,
787
- code: "UNAUTHORIZED",
788
- name: "Unauthorized Error",
789
- message: "unauthorized",
790
- uiMessage: "Authentication required. Please log in to continue.",
791
- type: "http"
792
- },
793
- PAYMENT_REQUIRED: {
794
- httpStatus: 402,
795
- code: "PAYMENT_REQUIRED",
796
- name: "Payment Required Error",
797
- message: "payment required",
798
- uiMessage: "Payment is required to access this resource.",
799
- type: "http"
800
- },
801
- FORBIDDEN: {
802
- httpStatus: 403,
803
- code: "FORBIDDEN",
804
- name: "Forbidden Error",
805
- message: "forbidden",
806
- uiMessage: "You do not have permission to access this resource.",
807
- type: "http"
808
- },
809
- NOT_FOUND: {
810
- httpStatus: 404,
811
- code: "NOT_FOUND",
812
- name: "Not Found Error",
813
- message: "not found",
814
- uiMessage: "The requested resource could not be found.",
815
- type: "http"
816
- },
817
- METHOD_NOT_ALLOWED: {
818
- httpStatus: 405,
819
- code: "METHOD_NOT_ALLOWED",
820
- name: "Method Not Allowed Error",
821
- message: "method not allowed",
822
- uiMessage: "This action is not allowed for the requested resource.",
823
- type: "http"
824
- },
825
- NOT_ACCEPTABLE: {
826
- httpStatus: 406,
827
- code: "NOT_ACCEPTABLE",
828
- name: "Not Acceptable Error",
829
- message: "not acceptable",
830
- uiMessage: "The requested format is not supported.",
831
- type: "http"
832
- },
833
- PROXY_AUTHENTICATION_REQUIRED: {
834
- httpStatus: 407,
835
- code: "PROXY_AUTHENTICATION_REQUIRED",
836
- name: "Proxy Authentication Required Error",
837
- message: "proxy authentication required",
838
- uiMessage: "Proxy authentication is required to access this resource.",
839
- type: "http"
840
- },
841
- REQUEST_TIMEOUT: {
842
- httpStatus: 408,
843
- code: "REQUEST_TIMEOUT",
844
- name: "Request Timeout Error",
845
- message: "request timeout",
846
- uiMessage: "The request took too long to complete. Please try again.",
847
- type: "http"
848
- },
849
- CONFLICT: {
850
- httpStatus: 409,
851
- code: "CONFLICT",
852
- name: "Conflict Error",
853
- message: "conflict",
854
- uiMessage: "The request conflicts with the current state. Please refresh and try again.",
855
- type: "http"
856
- },
857
- GONE: {
858
- httpStatus: 410,
859
- code: "GONE",
860
- name: "Gone Error",
861
- message: "gone",
862
- uiMessage: "This resource is no longer available.",
863
- type: "http"
864
- },
865
- LENGTH_REQUIRED: {
866
- httpStatus: 411,
867
- code: "LENGTH_REQUIRED",
868
- name: "Length Required Error",
869
- message: "length required",
870
- uiMessage: "The request is missing required length information.",
871
- type: "http"
872
- },
873
- PRECONDITION_FAILED: {
874
- httpStatus: 412,
875
- code: "PRECONDITION_FAILED",
876
- name: "Precondition Failed Error",
877
- message: "precondition failed",
878
- uiMessage: "A required condition was not met. Please try again.",
879
- type: "http"
880
- },
881
- PAYLOAD_TOO_LARGE: {
882
- httpStatus: 413,
883
- code: "PAYLOAD_TOO_LARGE",
884
- name: "Payload Too Large Error",
885
- message: "payload too large",
886
- uiMessage: "The request is too large. Please reduce the size and try again.",
887
- type: "http"
888
- },
889
- URI_TOO_LONG: {
890
- httpStatus: 414,
891
- code: "URI_TOO_LONG",
892
- name: "URI Too Long Error",
893
- message: "URI too long",
894
- uiMessage: "The request URL is too long.",
895
- type: "http"
896
- },
897
- UNSUPPORTED_MEDIA_TYPE: {
898
- httpStatus: 415,
899
- code: "UNSUPPORTED_MEDIA_TYPE",
900
- name: "Unsupported Media Type Error",
901
- message: "unsupported media type",
902
- uiMessage: "The file type is not supported.",
903
- type: "http"
904
- },
905
- RANGE_NOT_SATISFIABLE: {
906
- httpStatus: 416,
907
- code: "RANGE_NOT_SATISFIABLE",
908
- name: "Range Not Satisfiable Error",
909
- message: "range not satisfiable",
910
- uiMessage: "The requested range cannot be satisfied.",
911
- type: "http"
912
- },
913
- EXPECTATION_FAILED: {
914
- httpStatus: 417,
915
- code: "EXPECTATION_FAILED",
916
- name: "Expectation Failed Error",
917
- message: "expectation failed",
918
- uiMessage: "The server cannot meet the requirements of the request.",
919
- type: "http"
920
- },
921
- IM_A_TEAPOT: {
922
- httpStatus: 418,
923
- code: "IM_A_TEAPOT",
924
- name: "Im A Teapot Error",
925
- message: "i'm a teapot",
926
- uiMessage: "I'm a teapot and cannot brew coffee.",
927
- type: "http"
928
- },
929
- UNPROCESSABLE_ENTITY: {
930
- httpStatus: 422,
931
- code: "UNPROCESSABLE_ENTITY",
932
- name: "Unprocessable Entity Error",
933
- message: "unprocessable entity",
934
- uiMessage: "The request contains invalid data. Please check your input.",
935
- type: "http"
936
- },
937
- LOCKED: {
938
- httpStatus: 423,
939
- code: "LOCKED",
940
- name: "Locked Error",
941
- message: "locked",
942
- uiMessage: "This resource is locked and cannot be modified.",
943
- type: "http"
944
- },
945
- FAILED_DEPENDENCY: {
946
- httpStatus: 424,
947
- code: "FAILED_DEPENDENCY",
948
- name: "Failed Dependency Error",
949
- message: "failed dependency",
950
- uiMessage: "The request failed due to a dependency error.",
951
- type: "http"
952
- },
953
- TOO_EARLY: {
954
- httpStatus: 425,
955
- code: "TOO_EARLY",
956
- name: "Too Early Error",
957
- message: "too early",
958
- uiMessage: "The request was sent too early. Please try again later.",
959
- type: "http"
960
- },
961
- UPGRADE_REQUIRED: {
962
- httpStatus: 426,
963
- code: "UPGRADE_REQUIRED",
964
- name: "Upgrade Required Error",
965
- message: "upgrade required",
966
- uiMessage: "Please upgrade to continue using this service.",
967
- type: "http"
968
- },
969
- PRECONDITION_REQUIRED: {
970
- httpStatus: 428,
971
- code: "PRECONDITION_REQUIRED",
972
- name: "Precondition Required Error",
973
- message: "precondition required",
974
- uiMessage: "Required conditions are missing from the request.",
975
- type: "http"
976
- },
977
- TOO_MANY_REQUESTS: {
978
- httpStatus: 429,
979
- code: "TOO_MANY_REQUESTS",
980
- name: "Too Many Requests Error",
981
- message: "too many requests",
982
- uiMessage: "You have made too many requests. Please wait and try again.",
983
- type: "http"
984
- },
985
- REQUEST_HEADER_FIELDS_TOO_LARGE: {
986
- httpStatus: 431,
987
- code: "REQUEST_HEADER_FIELDS_TOO_LARGE",
988
- name: "Request Header Fields Too Large Error",
989
- message: "request header fields too large",
990
- uiMessage: "The request headers are too large.",
991
- type: "http"
992
- },
993
- UNAVAILABLE_FOR_LEGAL_REASONS: {
994
- httpStatus: 451,
995
- code: "UNAVAILABLE_FOR_LEGAL_REASONS",
996
- name: "Unavailable For Legal Reasons Error",
997
- message: "unavailable for legal reasons",
998
- uiMessage: "This content is unavailable for legal reasons.",
999
- type: "http"
1000
- },
1001
- // 5xx Server Errors
1002
- INTERNAL_SERVER_ERROR: {
1003
- httpStatus: 500,
1004
- code: "INTERNAL_SERVER_ERROR",
1005
- name: "Internal Server Error",
1006
- message: "internal server error",
1007
- uiMessage: "An unexpected error occurred. Please try again later.",
1008
- type: "http"
1009
- },
1010
- NOT_IMPLEMENTED: {
1011
- httpStatus: 501,
1012
- code: "NOT_IMPLEMENTED",
1013
- name: "Not Implemented Error",
1014
- message: "not implemented",
1015
- uiMessage: "This feature is not yet available.",
1016
- type: "http"
1017
- },
1018
- BAD_GATEWAY: {
1019
- httpStatus: 502,
1020
- code: "BAD_GATEWAY",
1021
- name: "Bad Gateway Error",
1022
- message: "bad gateway",
1023
- uiMessage: "Unable to connect to the server. Please try again later.",
1024
- type: "http"
1025
- },
1026
- SERVICE_UNAVAILABLE: {
1027
- httpStatus: 503,
1028
- code: "SERVICE_UNAVAILABLE",
1029
- name: "Service Unavailable Error",
1030
- message: "service unavailable",
1031
- uiMessage: "The service is temporarily unavailable. Please try again later.",
1032
- type: "http"
1033
- },
1034
- GATEWAY_TIMEOUT: {
1035
- httpStatus: 504,
1036
- code: "GATEWAY_TIMEOUT",
1037
- name: "Gateway Timeout Error",
1038
- message: "gateway timeout",
1039
- uiMessage: "The server took too long to respond. Please try again.",
1040
- type: "http"
1041
- },
1042
- HTTP_VERSION_NOT_SUPPORTED: {
1043
- httpStatus: 505,
1044
- code: "HTTP_VERSION_NOT_SUPPORTED",
1045
- name: "HTTP Version Not Supported Error",
1046
- message: "HTTP version not supported",
1047
- uiMessage: "Your browser version is not supported.",
1048
- type: "http"
1049
- },
1050
- VARIANT_ALSO_NEGOTIATES: {
1051
- httpStatus: 506,
1052
- code: "VARIANT_ALSO_NEGOTIATES",
1053
- name: "Variant Also Negotiates Error",
1054
- message: "variant also negotiates",
1055
- uiMessage: "The server has an internal configuration error.",
1056
- type: "http"
1057
- },
1058
- INSUFFICIENT_STORAGE: {
1059
- httpStatus: 507,
1060
- code: "INSUFFICIENT_STORAGE",
1061
- name: "Insufficient Storage Error",
1062
- message: "insufficient storage",
1063
- uiMessage: "The server has insufficient storage to complete the request.",
1064
- type: "http"
1065
- },
1066
- LOOP_DETECTED: {
1067
- httpStatus: 508,
1068
- code: "LOOP_DETECTED",
1069
- name: "Loop Detected Error",
1070
- message: "loop detected",
1071
- uiMessage: "The server detected an infinite loop.",
1072
- type: "http"
1073
- },
1074
- NOT_EXTENDED: {
1075
- httpStatus: 510,
1076
- code: "NOT_EXTENDED",
1077
- name: "Not Extended Error",
1078
- message: "not extended",
1079
- uiMessage: "Additional extensions are required.",
1080
- type: "http"
1081
- },
1082
- NETWORK_AUTHENTICATION_REQUIRED: {
1083
- httpStatus: 511,
1084
- code: "NETWORK_AUTHENTICATION_REQUIRED",
1085
- name: "Network Authentication Required Error",
1086
- message: "network authentication required",
1087
- uiMessage: "Network authentication is required to access this resource.",
1088
- type: "http"
1089
- }
1090
- };
681
+ };
682
+
683
+ // src/presets.ts
684
+ var http = {
685
+ // 4xx Client Errors
686
+ badRequest: {
687
+ httpStatus: 400,
688
+ code: "BAD_REQUEST",
689
+ name: "Bad Request Error",
690
+ message: "Bad request.",
691
+ uiMessage: "The request could not be processed. Please check your input and try again.",
692
+ type: "http"
693
+ },
694
+ unauthorized: {
695
+ httpStatus: 401,
696
+ code: "UNAUTHORIZED",
697
+ name: "Unauthorized Error",
698
+ message: "Unauthorized.",
699
+ uiMessage: "Authentication required. Please log in to continue.",
700
+ type: "http"
701
+ },
702
+ paymentRequired: {
703
+ httpStatus: 402,
704
+ code: "PAYMENT_REQUIRED",
705
+ name: "Payment Required Error",
706
+ message: "Payment required.",
707
+ uiMessage: "Payment is required to access this resource.",
708
+ type: "http"
709
+ },
710
+ forbidden: {
711
+ httpStatus: 403,
712
+ code: "FORBIDDEN",
713
+ name: "Forbidden Error",
714
+ message: "Forbidden.",
715
+ uiMessage: "You do not have permission to access this resource.",
716
+ type: "http"
717
+ },
718
+ notFound: {
719
+ httpStatus: 404,
720
+ code: "NOT_FOUND",
721
+ name: "Not Found Error",
722
+ message: "Not found.",
723
+ uiMessage: "The requested resource could not be found.",
724
+ type: "http"
725
+ },
726
+ methodNotAllowed: {
727
+ httpStatus: 405,
728
+ code: "METHOD_NOT_ALLOWED",
729
+ name: "Method Not Allowed Error",
730
+ message: "Method not allowed.",
731
+ uiMessage: "This action is not allowed for the requested resource.",
732
+ type: "http"
733
+ },
734
+ notAcceptable: {
735
+ httpStatus: 406,
736
+ code: "NOT_ACCEPTABLE",
737
+ name: "Not Acceptable Error",
738
+ message: "Not acceptable.",
739
+ uiMessage: "The requested format is not supported.",
740
+ type: "http"
741
+ },
742
+ proxyAuthenticationRequired: {
743
+ httpStatus: 407,
744
+ code: "PROXY_AUTHENTICATION_REQUIRED",
745
+ name: "Proxy Authentication Required Error",
746
+ message: "Proxy authentication required.",
747
+ uiMessage: "Proxy authentication is required to access this resource.",
748
+ type: "http"
749
+ },
750
+ requestTimeout: {
751
+ httpStatus: 408,
752
+ code: "REQUEST_TIMEOUT",
753
+ name: "Request Timeout Error",
754
+ message: "Request timeout.",
755
+ uiMessage: "The request took too long to complete. Please try again.",
756
+ type: "http"
757
+ },
758
+ conflict: {
759
+ httpStatus: 409,
760
+ code: "CONFLICT",
761
+ name: "Conflict Error",
762
+ message: "Conflict.",
763
+ uiMessage: "The request conflicts with the current state. Please refresh and try again.",
764
+ type: "http"
765
+ },
766
+ gone: {
767
+ httpStatus: 410,
768
+ code: "GONE",
769
+ name: "Gone Error",
770
+ message: "Gone.",
771
+ uiMessage: "This resource is no longer available.",
772
+ type: "http"
773
+ },
774
+ lengthRequired: {
775
+ httpStatus: 411,
776
+ code: "LENGTH_REQUIRED",
777
+ name: "Length Required Error",
778
+ message: "Length required.",
779
+ uiMessage: "The request is missing required length information.",
780
+ type: "http"
781
+ },
782
+ preconditionFailed: {
783
+ httpStatus: 412,
784
+ code: "PRECONDITION_FAILED",
785
+ name: "Precondition Failed Error",
786
+ message: "Precondition failed.",
787
+ uiMessage: "A required condition was not met. Please try again.",
788
+ type: "http"
789
+ },
790
+ payloadTooLarge: {
791
+ httpStatus: 413,
792
+ code: "PAYLOAD_TOO_LARGE",
793
+ name: "Payload Too Large Error",
794
+ message: "Payload too large.",
795
+ uiMessage: "The request is too large. Please reduce the size and try again.",
796
+ type: "http"
797
+ },
798
+ uriTooLong: {
799
+ httpStatus: 414,
800
+ code: "URI_TOO_LONG",
801
+ name: "URI Too Long Error",
802
+ message: "URI too long.",
803
+ uiMessage: "The request URL is too long.",
804
+ type: "http"
805
+ },
806
+ unsupportedMediaType: {
807
+ httpStatus: 415,
808
+ code: "UNSUPPORTED_MEDIA_TYPE",
809
+ name: "Unsupported Media Type Error",
810
+ message: "Unsupported media type.",
811
+ uiMessage: "The file type is not supported.",
812
+ type: "http"
813
+ },
814
+ rangeNotSatisfiable: {
815
+ httpStatus: 416,
816
+ code: "RANGE_NOT_SATISFIABLE",
817
+ name: "Range Not Satisfiable Error",
818
+ message: "Range not satisfiable.",
819
+ uiMessage: "The requested range cannot be satisfied.",
820
+ type: "http"
821
+ },
822
+ expectationFailed: {
823
+ httpStatus: 417,
824
+ code: "EXPECTATION_FAILED",
825
+ name: "Expectation Failed Error",
826
+ message: "Expectation failed.",
827
+ uiMessage: "The server cannot meet the requirements of the request.",
828
+ type: "http"
829
+ },
830
+ imATeapot: {
831
+ httpStatus: 418,
832
+ code: "IM_A_TEAPOT",
833
+ name: "Im A Teapot Error",
834
+ message: "I'm a teapot.",
835
+ uiMessage: "I'm a teapot and cannot brew coffee.",
836
+ type: "http"
837
+ },
838
+ unprocessableEntity: {
839
+ httpStatus: 422,
840
+ code: "UNPROCESSABLE_ENTITY",
841
+ name: "Unprocessable Entity Error",
842
+ message: "Unprocessable entity.",
843
+ uiMessage: "The request contains invalid data. Please check your input.",
844
+ type: "http"
845
+ },
846
+ locked: {
847
+ httpStatus: 423,
848
+ code: "LOCKED",
849
+ name: "Locked Error",
850
+ message: "Locked.",
851
+ uiMessage: "This resource is locked and cannot be modified.",
852
+ type: "http"
853
+ },
854
+ failedDependency: {
855
+ httpStatus: 424,
856
+ code: "FAILED_DEPENDENCY",
857
+ name: "Failed Dependency Error",
858
+ message: "Failed dependency.",
859
+ uiMessage: "The request failed due to a dependency error.",
860
+ type: "http"
861
+ },
862
+ tooEarly: {
863
+ httpStatus: 425,
864
+ code: "TOO_EARLY",
865
+ name: "Too Early Error",
866
+ message: "Too early.",
867
+ uiMessage: "The request was sent too early. Please try again later.",
868
+ type: "http"
869
+ },
870
+ upgradeRequired: {
871
+ httpStatus: 426,
872
+ code: "UPGRADE_REQUIRED",
873
+ name: "Upgrade Required Error",
874
+ message: "Upgrade required.",
875
+ uiMessage: "Please upgrade to continue using this service.",
876
+ type: "http"
877
+ },
878
+ preconditionRequired: {
879
+ httpStatus: 428,
880
+ code: "PRECONDITION_REQUIRED",
881
+ name: "Precondition Required Error",
882
+ message: "Precondition required.",
883
+ uiMessage: "Required conditions are missing from the request.",
884
+ type: "http"
885
+ },
886
+ tooManyRequests: {
887
+ httpStatus: 429,
888
+ code: "TOO_MANY_REQUESTS",
889
+ name: "Too Many Requests Error",
890
+ message: "Too many requests.",
891
+ uiMessage: "You have made too many requests. Please wait and try again.",
892
+ type: "http"
893
+ },
894
+ requestHeaderFieldsTooLarge: {
895
+ httpStatus: 431,
896
+ code: "REQUEST_HEADER_FIELDS_TOO_LARGE",
897
+ name: "Request Header Fields Too Large Error",
898
+ message: "Request header fields too large.",
899
+ uiMessage: "The request headers are too large.",
900
+ type: "http"
901
+ },
902
+ unavailableForLegalReasons: {
903
+ httpStatus: 451,
904
+ code: "UNAVAILABLE_FOR_LEGAL_REASONS",
905
+ name: "Unavailable For Legal Reasons Error",
906
+ message: "Unavailable for legal reasons.",
907
+ uiMessage: "This content is unavailable for legal reasons.",
908
+ type: "http"
909
+ },
910
+ // 5xx Server Errors
911
+ internalServerError: {
912
+ httpStatus: 500,
913
+ code: "INTERNAL_SERVER_ERROR",
914
+ name: "Internal Server Error",
915
+ message: "Internal server error.",
916
+ uiMessage: "An unexpected error occurred. Please try again later.",
917
+ type: "http"
918
+ },
919
+ notImplemented: {
920
+ httpStatus: 501,
921
+ code: "NOT_IMPLEMENTED",
922
+ name: "Not Implemented Error",
923
+ message: "Not implemented.",
924
+ uiMessage: "This feature is not yet available.",
925
+ type: "http"
926
+ },
927
+ badGateway: {
928
+ httpStatus: 502,
929
+ code: "BAD_GATEWAY",
930
+ name: "Bad Gateway Error",
931
+ message: "Bad gateway.",
932
+ uiMessage: "Unable to connect to the server. Please try again later.",
933
+ type: "http"
934
+ },
935
+ serviceUnavailable: {
936
+ httpStatus: 503,
937
+ code: "SERVICE_UNAVAILABLE",
938
+ name: "Service Unavailable Error",
939
+ message: "Service unavailable.",
940
+ uiMessage: "The service is temporarily unavailable. Please try again later.",
941
+ type: "http"
942
+ },
943
+ gatewayTimeout: {
944
+ httpStatus: 504,
945
+ code: "GATEWAY_TIMEOUT",
946
+ name: "Gateway Timeout Error",
947
+ message: "Gateway timeout.",
948
+ uiMessage: "The server took too long to respond. Please try again.",
949
+ type: "http"
950
+ },
951
+ httpVersionNotSupported: {
952
+ httpStatus: 505,
953
+ code: "HTTP_VERSION_NOT_SUPPORTED",
954
+ name: "HTTP Version Not Supported Error",
955
+ message: "HTTP version not supported.",
956
+ uiMessage: "Your browser version is not supported.",
957
+ type: "http"
958
+ },
959
+ variantAlsoNegotiates: {
960
+ httpStatus: 506,
961
+ code: "VARIANT_ALSO_NEGOTIATES",
962
+ name: "Variant Also Negotiates Error",
963
+ message: "Variant also negotiates.",
964
+ uiMessage: "The server has an internal configuration error.",
965
+ type: "http"
966
+ },
967
+ insufficientStorage: {
968
+ httpStatus: 507,
969
+ code: "INSUFFICIENT_STORAGE",
970
+ name: "Insufficient Storage Error",
971
+ message: "Insufficient storage.",
972
+ uiMessage: "The server has insufficient storage to complete the request.",
973
+ type: "http"
974
+ },
975
+ loopDetected: {
976
+ httpStatus: 508,
977
+ code: "LOOP_DETECTED",
978
+ name: "Loop Detected Error",
979
+ message: "Loop detected.",
980
+ uiMessage: "The server detected an infinite loop.",
981
+ type: "http"
982
+ },
983
+ notExtended: {
984
+ httpStatus: 510,
985
+ code: "NOT_EXTENDED",
986
+ name: "Not Extended Error",
987
+ message: "Not extended.",
988
+ uiMessage: "Additional extensions are required.",
989
+ type: "http"
990
+ },
991
+ networkAuthenticationRequired: {
992
+ httpStatus: 511,
993
+ code: "NETWORK_AUTHENTICATION_REQUIRED",
994
+ name: "Network Authentication Required Error",
995
+ message: "Network authentication required.",
996
+ uiMessage: "Network authentication is required to access this resource.",
997
+ type: "http"
998
+ }
1091
999
  };
1092
1000
 
1093
1001
  exports.ErrorX = ErrorX;
1094
- exports.HandlingTargets = HandlingTargets;
1002
+ exports.http = http;
1095
1003
  //# sourceMappingURL=index.cjs.map
1096
1004
  //# sourceMappingURL=index.cjs.map