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