@bombillazo/error-x 0.4.1 → 0.4.3
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 +19 -14
- package/dist/index.cjs +77 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +89 -90
- package/dist/index.d.ts +89 -90
- package/dist/index.js +77 -104
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,6 @@ yarn add @bombillazo/error-x
|
|
|
36
36
|
|
|
37
37
|
This library uses modern JavaScript features and ES2022 APIs. For browser compatibility, ensure your build tool (e.g., Vite, webpack, esbuild) is configured to target ES2022 or transpile accordingly.
|
|
38
38
|
|
|
39
|
-
|
|
40
39
|
> [!WARNING]
|
|
41
40
|
>
|
|
42
41
|
> This library is currently in pre-v1.0 development. While we strive to minimize breaking changes, the API may evolve based on feedback and real-world usage. We recommend pinning to specific versions and reviewing release notes when updating.
|
|
@@ -64,11 +63,11 @@ throw new ErrorX({
|
|
|
64
63
|
})
|
|
65
64
|
|
|
66
65
|
// Using HTTP presets
|
|
67
|
-
throw new ErrorX(http
|
|
66
|
+
throw new ErrorX(http[404])
|
|
68
67
|
|
|
69
68
|
// Customizing presets
|
|
70
69
|
throw new ErrorX({
|
|
71
|
-
...http
|
|
70
|
+
...http[401],
|
|
72
71
|
message: 'Session expired',
|
|
73
72
|
metadata: { userId: 123 }
|
|
74
73
|
})
|
|
@@ -116,12 +115,12 @@ ErrorX provides pre-configured error templates via the `http` export:
|
|
|
116
115
|
import { ErrorX, http } from '@bombillazo/error-x'
|
|
117
116
|
|
|
118
117
|
// Use preset directly
|
|
119
|
-
throw new ErrorX(http
|
|
118
|
+
throw new ErrorX(http[404])
|
|
120
119
|
// Result: 404 error with message "Not found.", code "NOT_FOUND", etc.
|
|
121
120
|
|
|
122
121
|
// Override specific fields
|
|
123
122
|
throw new ErrorX({
|
|
124
|
-
...http
|
|
123
|
+
...http[404],
|
|
125
124
|
message: 'User not found',
|
|
126
125
|
metadata: { userId: 123 }
|
|
127
126
|
})
|
|
@@ -131,7 +130,7 @@ try {
|
|
|
131
130
|
// some operation
|
|
132
131
|
} catch (originalError) {
|
|
133
132
|
throw new ErrorX({
|
|
134
|
-
...http
|
|
133
|
+
...http[500],
|
|
135
134
|
cause: originalError,
|
|
136
135
|
metadata: { operation: 'database-query' }
|
|
137
136
|
})
|
|
@@ -140,7 +139,7 @@ try {
|
|
|
140
139
|
|
|
141
140
|
#### Available Presets
|
|
142
141
|
|
|
143
|
-
All presets
|
|
142
|
+
All presets are indexed by **HTTP status code** (numeric keys) and include:
|
|
144
143
|
- `httpStatus`: HTTP status code
|
|
145
144
|
- `code`: Error code in UPPER_SNAKE_CASE
|
|
146
145
|
- `name`: Descriptive error name
|
|
@@ -149,10 +148,11 @@ All presets use **camelCase naming** and include:
|
|
|
149
148
|
- `type`: Set to `'http'` for all HTTP presets
|
|
150
149
|
|
|
151
150
|
**4xx Client Errors:**
|
|
152
|
-
|
|
151
|
+
|
|
152
|
+
`400`, `401`, `402`, `403`, `404`, `405`, `406`, `407`, `408`, `409`, `410`, `411`, `412`, `413`, `414`, `415`, `416`, `417`, `418`, `422`, `423`, `424`, `425`, `426`, `428`, `429`, `431`, `451`
|
|
153
153
|
|
|
154
154
|
**5xx Server Errors:**
|
|
155
|
-
`
|
|
155
|
+
`500`, `501`, `502`, `503`, `504`, `505`, `506`, `507`, `508`, `510`, `511`
|
|
156
156
|
|
|
157
157
|
#### Creating Your Own Presets
|
|
158
158
|
|
|
@@ -281,14 +281,19 @@ const enriched = error.withMetadata({ b: 2 })
|
|
|
281
281
|
// enriched.metadata = { a: 1, b: 2 }
|
|
282
282
|
```
|
|
283
283
|
|
|
284
|
-
#### `
|
|
284
|
+
#### `ErrorX.cleanStack(stack?: string, delimiter?: string): string`
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
Cleans a stack trace by removing ErrorX internal calls and optionally trimming after a delimiter:
|
|
287
287
|
|
|
288
288
|
```typescript
|
|
289
289
|
const error = new ErrorX('test')
|
|
290
|
-
|
|
291
|
-
//
|
|
290
|
+
|
|
291
|
+
// Clean with pattern-based removal only
|
|
292
|
+
const cleaned = ErrorX.cleanStack(error.stack)
|
|
293
|
+
|
|
294
|
+
// Clean and trim after delimiter
|
|
295
|
+
const trimmed = ErrorX.cleanStack(error.stack, 'my-app-boundary')
|
|
296
|
+
// Returns stack trace starting after the line containing 'my-app-boundary'
|
|
292
297
|
```
|
|
293
298
|
|
|
294
299
|
#### `toJSON(): ErrorXSerialized`
|
|
@@ -339,7 +344,7 @@ async function fetchUser(id: string) {
|
|
|
339
344
|
const response = await fetch(`/api/users/${id}`)
|
|
340
345
|
if (!response.ok) {
|
|
341
346
|
throw new ErrorX({
|
|
342
|
-
...http[response.status === 404 ?
|
|
347
|
+
...http[response.status === 404 ? 404 : 500],
|
|
343
348
|
metadata: { status: response.status, statusText: response.statusText }
|
|
344
349
|
})
|
|
345
350
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -181,7 +181,8 @@ var ErrorX = class _ErrorX extends Error {
|
|
|
181
181
|
* docsMap: {
|
|
182
182
|
* 'AUTH_FAILED': 'authentication-errors',
|
|
183
183
|
* 'DB_ERROR': 'database-errors'
|
|
184
|
-
* }
|
|
184
|
+
* },
|
|
185
|
+
* cleanStackDelimiter: 'app-entry-point' // Trim stack traces after this line
|
|
185
186
|
* })
|
|
186
187
|
* ```
|
|
187
188
|
*/
|
|
@@ -195,6 +196,19 @@ var ErrorX = class _ErrorX extends Error {
|
|
|
195
196
|
static getConfig() {
|
|
196
197
|
return _ErrorX._config;
|
|
197
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Reset global configuration to null.
|
|
201
|
+
* Useful for testing or when you want to clear all configuration.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* ErrorX.resetConfig()
|
|
206
|
+
* const config = ErrorX.getConfig() // null
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
static resetConfig() {
|
|
210
|
+
_ErrorX._config = null;
|
|
211
|
+
}
|
|
198
212
|
/**
|
|
199
213
|
* Validates HTTP status code to ensure it's within valid range (100-599)
|
|
200
214
|
*
|
|
@@ -282,13 +296,24 @@ var ErrorX = class _ErrorX extends Error {
|
|
|
282
296
|
return [newErrorFirstLine, ...originalStackTrace].join("\n");
|
|
283
297
|
}
|
|
284
298
|
/**
|
|
285
|
-
* Cleans
|
|
299
|
+
* Cleans a stack trace by removing ErrorX internal method calls and optionally trimming after a delimiter.
|
|
286
300
|
* This provides cleaner stack traces that focus on user code.
|
|
287
301
|
*
|
|
288
|
-
* @param stack - Raw stack trace to clean
|
|
289
|
-
* @
|
|
302
|
+
* @param stack - Raw stack trace string to clean
|
|
303
|
+
* @param delimiter - Optional delimiter to trim stack trace after (overrides config delimiter)
|
|
304
|
+
* @returns Cleaned stack trace without internal calls and optionally trimmed after delimiter
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```typescript
|
|
308
|
+
* // Clean with pattern-based removal only
|
|
309
|
+
* const cleaned = ErrorX.cleanStack(error.stack)
|
|
310
|
+
*
|
|
311
|
+
* // Clean and trim after delimiter
|
|
312
|
+
* const trimmed = ErrorX.cleanStack(error.stack, 'my-app-entry')
|
|
313
|
+
* // Returns stack trace starting after the line containing 'my-app-entry'
|
|
314
|
+
* ```
|
|
290
315
|
*/
|
|
291
|
-
static cleanStack(stack) {
|
|
316
|
+
static cleanStack(stack, delimiter) {
|
|
292
317
|
if (!stack) return "";
|
|
293
318
|
const config = _ErrorX.getConfig();
|
|
294
319
|
const cleanStackConfig = config?.cleanStack ?? true;
|
|
@@ -312,30 +337,15 @@ var ErrorX = class _ErrorX extends Error {
|
|
|
312
337
|
}
|
|
313
338
|
cleanedLines.push(line);
|
|
314
339
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
* @param delimiter - String to search for in stack lines
|
|
323
|
-
* @returns Processed stack trace starting after the delimiter
|
|
324
|
-
*
|
|
325
|
-
* @example
|
|
326
|
-
* ```typescript
|
|
327
|
-
* const processed = ErrorX.processErrorStack(error, 'my-app-entry')
|
|
328
|
-
* // Returns stack trace starting after the line containing 'my-app-entry'
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
|
-
static processErrorStack(error, delimiter) {
|
|
332
|
-
let stack = error.stack ?? "";
|
|
333
|
-
const stackLines = stack.split("\n");
|
|
334
|
-
const delimiterIndex = stackLines.findIndex((line) => line.includes(delimiter));
|
|
335
|
-
if (delimiterIndex !== -1) {
|
|
336
|
-
stack = stackLines.slice(delimiterIndex + 1).join("\n");
|
|
340
|
+
let cleanedStack = cleanedLines.join("\n");
|
|
341
|
+
const activeDelimiter = delimiter ?? config?.cleanStackDelimiter;
|
|
342
|
+
if (activeDelimiter) {
|
|
343
|
+
const delimiterIndex = cleanedLines.findIndex((line) => line.includes(activeDelimiter));
|
|
344
|
+
if (delimiterIndex !== -1) {
|
|
345
|
+
cleanedStack = cleanedLines.slice(delimiterIndex + 1).join("\n");
|
|
346
|
+
}
|
|
337
347
|
}
|
|
338
|
-
return
|
|
348
|
+
return cleanedStack;
|
|
339
349
|
}
|
|
340
350
|
/**
|
|
341
351
|
* Creates a new ErrorX instance with additional metadata merged with existing metadata.
|
|
@@ -500,43 +510,6 @@ var ErrorX = class _ErrorX extends Error {
|
|
|
500
510
|
const options = _ErrorX.convertUnknownToOptions(error);
|
|
501
511
|
return new _ErrorX(options);
|
|
502
512
|
}
|
|
503
|
-
/**
|
|
504
|
-
* Creates a new ErrorX instance with cleaned stack trace using the specified delimiter.
|
|
505
|
-
* Returns the same instance if no delimiter is provided or no stack is available.
|
|
506
|
-
*
|
|
507
|
-
* @param delimiter - Optional string to search for in stack lines
|
|
508
|
-
* @returns New ErrorX instance with cleaned stack trace, or the same instance if no cleaning needed
|
|
509
|
-
*
|
|
510
|
-
* @example
|
|
511
|
-
* ```typescript
|
|
512
|
-
* const error = new ErrorX({ message: 'Database error' })
|
|
513
|
-
* const cleanedError = error.cleanStackTrace('database-layer')
|
|
514
|
-
* // Returns new ErrorX with stack trace starting after 'database-layer'
|
|
515
|
-
* ```
|
|
516
|
-
*/
|
|
517
|
-
cleanStackTrace(delimiter) {
|
|
518
|
-
if (delimiter && this.stack) {
|
|
519
|
-
const options = {
|
|
520
|
-
message: this.message,
|
|
521
|
-
name: this.name,
|
|
522
|
-
code: this.code,
|
|
523
|
-
uiMessage: this.uiMessage,
|
|
524
|
-
cause: this.cause,
|
|
525
|
-
httpStatus: this.httpStatus,
|
|
526
|
-
type: this.type,
|
|
527
|
-
sourceUrl: this.sourceUrl,
|
|
528
|
-
docsUrl: this.docsUrl,
|
|
529
|
-
source: this.source
|
|
530
|
-
};
|
|
531
|
-
if (this.metadata !== void 0) {
|
|
532
|
-
options.metadata = this.metadata;
|
|
533
|
-
}
|
|
534
|
-
const newError = new _ErrorX(options);
|
|
535
|
-
newError.stack = _ErrorX.processErrorStack(this, delimiter);
|
|
536
|
-
return newError;
|
|
537
|
-
}
|
|
538
|
-
return this;
|
|
539
|
-
}
|
|
540
513
|
/**
|
|
541
514
|
* Converts the ErrorX instance to a detailed string representation.
|
|
542
515
|
* Includes error name, message, code, timestamp, metadata, and stack trace.
|
|
@@ -678,7 +651,7 @@ ${this.stack}`;
|
|
|
678
651
|
// src/presets.ts
|
|
679
652
|
var http = {
|
|
680
653
|
// 4xx Client Errors
|
|
681
|
-
|
|
654
|
+
400: {
|
|
682
655
|
httpStatus: 400,
|
|
683
656
|
code: "BAD_REQUEST",
|
|
684
657
|
name: "Bad Request Error",
|
|
@@ -686,7 +659,7 @@ var http = {
|
|
|
686
659
|
uiMessage: "The request could not be processed. Please check your input and try again.",
|
|
687
660
|
type: "http"
|
|
688
661
|
},
|
|
689
|
-
|
|
662
|
+
401: {
|
|
690
663
|
httpStatus: 401,
|
|
691
664
|
code: "UNAUTHORIZED",
|
|
692
665
|
name: "Unauthorized Error",
|
|
@@ -694,7 +667,7 @@ var http = {
|
|
|
694
667
|
uiMessage: "Authentication required. Please log in to continue.",
|
|
695
668
|
type: "http"
|
|
696
669
|
},
|
|
697
|
-
|
|
670
|
+
402: {
|
|
698
671
|
httpStatus: 402,
|
|
699
672
|
code: "PAYMENT_REQUIRED",
|
|
700
673
|
name: "Payment Required Error",
|
|
@@ -702,7 +675,7 @@ var http = {
|
|
|
702
675
|
uiMessage: "Payment is required to access this resource.",
|
|
703
676
|
type: "http"
|
|
704
677
|
},
|
|
705
|
-
|
|
678
|
+
403: {
|
|
706
679
|
httpStatus: 403,
|
|
707
680
|
code: "FORBIDDEN",
|
|
708
681
|
name: "Forbidden Error",
|
|
@@ -710,7 +683,7 @@ var http = {
|
|
|
710
683
|
uiMessage: "You do not have permission to access this resource.",
|
|
711
684
|
type: "http"
|
|
712
685
|
},
|
|
713
|
-
|
|
686
|
+
404: {
|
|
714
687
|
httpStatus: 404,
|
|
715
688
|
code: "NOT_FOUND",
|
|
716
689
|
name: "Not Found Error",
|
|
@@ -718,7 +691,7 @@ var http = {
|
|
|
718
691
|
uiMessage: "The requested resource could not be found.",
|
|
719
692
|
type: "http"
|
|
720
693
|
},
|
|
721
|
-
|
|
694
|
+
405: {
|
|
722
695
|
httpStatus: 405,
|
|
723
696
|
code: "METHOD_NOT_ALLOWED",
|
|
724
697
|
name: "Method Not Allowed Error",
|
|
@@ -726,7 +699,7 @@ var http = {
|
|
|
726
699
|
uiMessage: "This action is not allowed for the requested resource.",
|
|
727
700
|
type: "http"
|
|
728
701
|
},
|
|
729
|
-
|
|
702
|
+
406: {
|
|
730
703
|
httpStatus: 406,
|
|
731
704
|
code: "NOT_ACCEPTABLE",
|
|
732
705
|
name: "Not Acceptable Error",
|
|
@@ -734,7 +707,7 @@ var http = {
|
|
|
734
707
|
uiMessage: "The requested format is not supported.",
|
|
735
708
|
type: "http"
|
|
736
709
|
},
|
|
737
|
-
|
|
710
|
+
407: {
|
|
738
711
|
httpStatus: 407,
|
|
739
712
|
code: "PROXY_AUTHENTICATION_REQUIRED",
|
|
740
713
|
name: "Proxy Authentication Required Error",
|
|
@@ -742,7 +715,7 @@ var http = {
|
|
|
742
715
|
uiMessage: "Proxy authentication is required to access this resource.",
|
|
743
716
|
type: "http"
|
|
744
717
|
},
|
|
745
|
-
|
|
718
|
+
408: {
|
|
746
719
|
httpStatus: 408,
|
|
747
720
|
code: "REQUEST_TIMEOUT",
|
|
748
721
|
name: "Request Timeout Error",
|
|
@@ -750,7 +723,7 @@ var http = {
|
|
|
750
723
|
uiMessage: "The request took too long to complete. Please try again.",
|
|
751
724
|
type: "http"
|
|
752
725
|
},
|
|
753
|
-
|
|
726
|
+
409: {
|
|
754
727
|
httpStatus: 409,
|
|
755
728
|
code: "CONFLICT",
|
|
756
729
|
name: "Conflict Error",
|
|
@@ -758,7 +731,7 @@ var http = {
|
|
|
758
731
|
uiMessage: "The request conflicts with the current state. Please refresh and try again.",
|
|
759
732
|
type: "http"
|
|
760
733
|
},
|
|
761
|
-
|
|
734
|
+
410: {
|
|
762
735
|
httpStatus: 410,
|
|
763
736
|
code: "GONE",
|
|
764
737
|
name: "Gone Error",
|
|
@@ -766,7 +739,7 @@ var http = {
|
|
|
766
739
|
uiMessage: "This resource is no longer available.",
|
|
767
740
|
type: "http"
|
|
768
741
|
},
|
|
769
|
-
|
|
742
|
+
411: {
|
|
770
743
|
httpStatus: 411,
|
|
771
744
|
code: "LENGTH_REQUIRED",
|
|
772
745
|
name: "Length Required Error",
|
|
@@ -774,7 +747,7 @@ var http = {
|
|
|
774
747
|
uiMessage: "The request is missing required length information.",
|
|
775
748
|
type: "http"
|
|
776
749
|
},
|
|
777
|
-
|
|
750
|
+
412: {
|
|
778
751
|
httpStatus: 412,
|
|
779
752
|
code: "PRECONDITION_FAILED",
|
|
780
753
|
name: "Precondition Failed Error",
|
|
@@ -782,7 +755,7 @@ var http = {
|
|
|
782
755
|
uiMessage: "A required condition was not met. Please try again.",
|
|
783
756
|
type: "http"
|
|
784
757
|
},
|
|
785
|
-
|
|
758
|
+
413: {
|
|
786
759
|
httpStatus: 413,
|
|
787
760
|
code: "PAYLOAD_TOO_LARGE",
|
|
788
761
|
name: "Payload Too Large Error",
|
|
@@ -790,7 +763,7 @@ var http = {
|
|
|
790
763
|
uiMessage: "The request is too large. Please reduce the size and try again.",
|
|
791
764
|
type: "http"
|
|
792
765
|
},
|
|
793
|
-
|
|
766
|
+
414: {
|
|
794
767
|
httpStatus: 414,
|
|
795
768
|
code: "URI_TOO_LONG",
|
|
796
769
|
name: "URI Too Long Error",
|
|
@@ -798,7 +771,7 @@ var http = {
|
|
|
798
771
|
uiMessage: "The request URL is too long.",
|
|
799
772
|
type: "http"
|
|
800
773
|
},
|
|
801
|
-
|
|
774
|
+
415: {
|
|
802
775
|
httpStatus: 415,
|
|
803
776
|
code: "UNSUPPORTED_MEDIA_TYPE",
|
|
804
777
|
name: "Unsupported Media Type Error",
|
|
@@ -806,7 +779,7 @@ var http = {
|
|
|
806
779
|
uiMessage: "The file type is not supported.",
|
|
807
780
|
type: "http"
|
|
808
781
|
},
|
|
809
|
-
|
|
782
|
+
416: {
|
|
810
783
|
httpStatus: 416,
|
|
811
784
|
code: "RANGE_NOT_SATISFIABLE",
|
|
812
785
|
name: "Range Not Satisfiable Error",
|
|
@@ -814,7 +787,7 @@ var http = {
|
|
|
814
787
|
uiMessage: "The requested range cannot be satisfied.",
|
|
815
788
|
type: "http"
|
|
816
789
|
},
|
|
817
|
-
|
|
790
|
+
417: {
|
|
818
791
|
httpStatus: 417,
|
|
819
792
|
code: "EXPECTATION_FAILED",
|
|
820
793
|
name: "Expectation Failed Error",
|
|
@@ -822,7 +795,7 @@ var http = {
|
|
|
822
795
|
uiMessage: "The server cannot meet the requirements of the request.",
|
|
823
796
|
type: "http"
|
|
824
797
|
},
|
|
825
|
-
|
|
798
|
+
418: {
|
|
826
799
|
httpStatus: 418,
|
|
827
800
|
code: "IM_A_TEAPOT",
|
|
828
801
|
name: "Im A Teapot Error",
|
|
@@ -830,7 +803,7 @@ var http = {
|
|
|
830
803
|
uiMessage: "I'm a teapot and cannot brew coffee.",
|
|
831
804
|
type: "http"
|
|
832
805
|
},
|
|
833
|
-
|
|
806
|
+
422: {
|
|
834
807
|
httpStatus: 422,
|
|
835
808
|
code: "UNPROCESSABLE_ENTITY",
|
|
836
809
|
name: "Unprocessable Entity Error",
|
|
@@ -838,7 +811,7 @@ var http = {
|
|
|
838
811
|
uiMessage: "The request contains invalid data. Please check your input.",
|
|
839
812
|
type: "http"
|
|
840
813
|
},
|
|
841
|
-
|
|
814
|
+
423: {
|
|
842
815
|
httpStatus: 423,
|
|
843
816
|
code: "LOCKED",
|
|
844
817
|
name: "Locked Error",
|
|
@@ -846,7 +819,7 @@ var http = {
|
|
|
846
819
|
uiMessage: "This resource is locked and cannot be modified.",
|
|
847
820
|
type: "http"
|
|
848
821
|
},
|
|
849
|
-
|
|
822
|
+
424: {
|
|
850
823
|
httpStatus: 424,
|
|
851
824
|
code: "FAILED_DEPENDENCY",
|
|
852
825
|
name: "Failed Dependency Error",
|
|
@@ -854,7 +827,7 @@ var http = {
|
|
|
854
827
|
uiMessage: "The request failed due to a dependency error.",
|
|
855
828
|
type: "http"
|
|
856
829
|
},
|
|
857
|
-
|
|
830
|
+
425: {
|
|
858
831
|
httpStatus: 425,
|
|
859
832
|
code: "TOO_EARLY",
|
|
860
833
|
name: "Too Early Error",
|
|
@@ -862,7 +835,7 @@ var http = {
|
|
|
862
835
|
uiMessage: "The request was sent too early. Please try again later.",
|
|
863
836
|
type: "http"
|
|
864
837
|
},
|
|
865
|
-
|
|
838
|
+
426: {
|
|
866
839
|
httpStatus: 426,
|
|
867
840
|
code: "UPGRADE_REQUIRED",
|
|
868
841
|
name: "Upgrade Required Error",
|
|
@@ -870,7 +843,7 @@ var http = {
|
|
|
870
843
|
uiMessage: "Please upgrade to continue using this service.",
|
|
871
844
|
type: "http"
|
|
872
845
|
},
|
|
873
|
-
|
|
846
|
+
428: {
|
|
874
847
|
httpStatus: 428,
|
|
875
848
|
code: "PRECONDITION_REQUIRED",
|
|
876
849
|
name: "Precondition Required Error",
|
|
@@ -878,7 +851,7 @@ var http = {
|
|
|
878
851
|
uiMessage: "Required conditions are missing from the request.",
|
|
879
852
|
type: "http"
|
|
880
853
|
},
|
|
881
|
-
|
|
854
|
+
429: {
|
|
882
855
|
httpStatus: 429,
|
|
883
856
|
code: "TOO_MANY_REQUESTS",
|
|
884
857
|
name: "Too Many Requests Error",
|
|
@@ -886,7 +859,7 @@ var http = {
|
|
|
886
859
|
uiMessage: "You have made too many requests. Please wait and try again.",
|
|
887
860
|
type: "http"
|
|
888
861
|
},
|
|
889
|
-
|
|
862
|
+
431: {
|
|
890
863
|
httpStatus: 431,
|
|
891
864
|
code: "REQUEST_HEADER_FIELDS_TOO_LARGE",
|
|
892
865
|
name: "Request Header Fields Too Large Error",
|
|
@@ -894,7 +867,7 @@ var http = {
|
|
|
894
867
|
uiMessage: "The request headers are too large.",
|
|
895
868
|
type: "http"
|
|
896
869
|
},
|
|
897
|
-
|
|
870
|
+
451: {
|
|
898
871
|
httpStatus: 451,
|
|
899
872
|
code: "UNAVAILABLE_FOR_LEGAL_REASONS",
|
|
900
873
|
name: "Unavailable For Legal Reasons Error",
|
|
@@ -903,7 +876,7 @@ var http = {
|
|
|
903
876
|
type: "http"
|
|
904
877
|
},
|
|
905
878
|
// 5xx Server Errors
|
|
906
|
-
|
|
879
|
+
500: {
|
|
907
880
|
httpStatus: 500,
|
|
908
881
|
code: "INTERNAL_SERVER_ERROR",
|
|
909
882
|
name: "Internal Server Error",
|
|
@@ -911,7 +884,7 @@ var http = {
|
|
|
911
884
|
uiMessage: "An unexpected error occurred. Please try again later.",
|
|
912
885
|
type: "http"
|
|
913
886
|
},
|
|
914
|
-
|
|
887
|
+
501: {
|
|
915
888
|
httpStatus: 501,
|
|
916
889
|
code: "NOT_IMPLEMENTED",
|
|
917
890
|
name: "Not Implemented Error",
|
|
@@ -919,7 +892,7 @@ var http = {
|
|
|
919
892
|
uiMessage: "This feature is not yet available.",
|
|
920
893
|
type: "http"
|
|
921
894
|
},
|
|
922
|
-
|
|
895
|
+
502: {
|
|
923
896
|
httpStatus: 502,
|
|
924
897
|
code: "BAD_GATEWAY",
|
|
925
898
|
name: "Bad Gateway Error",
|
|
@@ -927,7 +900,7 @@ var http = {
|
|
|
927
900
|
uiMessage: "Unable to connect to the server. Please try again later.",
|
|
928
901
|
type: "http"
|
|
929
902
|
},
|
|
930
|
-
|
|
903
|
+
503: {
|
|
931
904
|
httpStatus: 503,
|
|
932
905
|
code: "SERVICE_UNAVAILABLE",
|
|
933
906
|
name: "Service Unavailable Error",
|
|
@@ -935,7 +908,7 @@ var http = {
|
|
|
935
908
|
uiMessage: "The service is temporarily unavailable. Please try again later.",
|
|
936
909
|
type: "http"
|
|
937
910
|
},
|
|
938
|
-
|
|
911
|
+
504: {
|
|
939
912
|
httpStatus: 504,
|
|
940
913
|
code: "GATEWAY_TIMEOUT",
|
|
941
914
|
name: "Gateway Timeout Error",
|
|
@@ -943,7 +916,7 @@ var http = {
|
|
|
943
916
|
uiMessage: "The server took too long to respond. Please try again.",
|
|
944
917
|
type: "http"
|
|
945
918
|
},
|
|
946
|
-
|
|
919
|
+
505: {
|
|
947
920
|
httpStatus: 505,
|
|
948
921
|
code: "HTTP_VERSION_NOT_SUPPORTED",
|
|
949
922
|
name: "HTTP Version Not Supported Error",
|
|
@@ -951,7 +924,7 @@ var http = {
|
|
|
951
924
|
uiMessage: "Your browser version is not supported.",
|
|
952
925
|
type: "http"
|
|
953
926
|
},
|
|
954
|
-
|
|
927
|
+
506: {
|
|
955
928
|
httpStatus: 506,
|
|
956
929
|
code: "VARIANT_ALSO_NEGOTIATES",
|
|
957
930
|
name: "Variant Also Negotiates Error",
|
|
@@ -959,7 +932,7 @@ var http = {
|
|
|
959
932
|
uiMessage: "The server has an internal configuration error.",
|
|
960
933
|
type: "http"
|
|
961
934
|
},
|
|
962
|
-
|
|
935
|
+
507: {
|
|
963
936
|
httpStatus: 507,
|
|
964
937
|
code: "INSUFFICIENT_STORAGE",
|
|
965
938
|
name: "Insufficient Storage Error",
|
|
@@ -967,7 +940,7 @@ var http = {
|
|
|
967
940
|
uiMessage: "The server has insufficient storage to complete the request.",
|
|
968
941
|
type: "http"
|
|
969
942
|
},
|
|
970
|
-
|
|
943
|
+
508: {
|
|
971
944
|
httpStatus: 508,
|
|
972
945
|
code: "LOOP_DETECTED",
|
|
973
946
|
name: "Loop Detected Error",
|
|
@@ -975,7 +948,7 @@ var http = {
|
|
|
975
948
|
uiMessage: "The server detected an infinite loop.",
|
|
976
949
|
type: "http"
|
|
977
950
|
},
|
|
978
|
-
|
|
951
|
+
510: {
|
|
979
952
|
httpStatus: 510,
|
|
980
953
|
code: "NOT_EXTENDED",
|
|
981
954
|
name: "Not Extended Error",
|
|
@@ -983,7 +956,7 @@ var http = {
|
|
|
983
956
|
uiMessage: "Additional extensions are required.",
|
|
984
957
|
type: "http"
|
|
985
958
|
},
|
|
986
|
-
|
|
959
|
+
511: {
|
|
987
960
|
httpStatus: 511,
|
|
988
961
|
code: "NETWORK_AUTHENTICATION_REQUIRED",
|
|
989
962
|
name: "Network Authentication Required Error",
|