@twin.org/core 0.0.1-next.9 → 0.0.2-next.10
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/cjs/index.cjs +2266 -1470
- package/dist/esm/index.mjs +2263 -1471
- package/dist/types/errors/alreadyExistsError.d.ts +2 -2
- package/dist/types/errors/baseError.d.ts +25 -5
- package/dist/types/errors/conflictError.d.ts +2 -2
- package/dist/types/errors/generalError.d.ts +2 -2
- package/dist/types/errors/notFoundError.d.ts +2 -2
- package/dist/types/errors/notSupportedError.d.ts +2 -2
- package/dist/types/errors/unauthorizedError.d.ts +2 -2
- package/dist/types/errors/unprocessableError.d.ts +2 -2
- package/dist/types/factories/factory.d.ts +21 -2
- package/dist/types/helpers/arrayHelper.d.ts +13 -0
- package/dist/types/helpers/envHelper.d.ts +16 -0
- package/dist/types/helpers/errorHelper.d.ts +5 -4
- package/dist/types/helpers/jsonHelper.d.ts +30 -0
- package/dist/types/helpers/objectHelper.d.ts +25 -0
- package/dist/types/helpers/uint8ArrayHelper.d.ts +11 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/models/IComponent.d.ts +6 -6
- package/dist/types/models/IError.d.ts +2 -2
- package/dist/types/models/II18nShared.d.ts +29 -0
- package/dist/types/models/coerceType.d.ts +49 -0
- package/dist/types/models/compressionType.d.ts +1 -1
- package/dist/types/models/objectOrArray.d.ts +4 -0
- package/dist/types/utils/asyncCache.d.ts +10 -1
- package/dist/types/utils/coerce.d.ts +22 -0
- package/dist/types/utils/guards.d.ts +35 -0
- package/dist/types/utils/is.d.ts +18 -0
- package/dist/types/utils/sharedStore.d.ts +23 -0
- package/dist/types/utils/validation.d.ts +2 -0
- package/docs/changelog.md +442 -1
- package/docs/reference/classes/AlreadyExistsError.md +166 -32
- package/docs/reference/classes/ArrayHelper.md +71 -5
- package/docs/reference/classes/AsyncCache.md +75 -13
- package/docs/reference/classes/Base32.md +9 -5
- package/docs/reference/classes/Base58.md +9 -5
- package/docs/reference/classes/Base64.md +12 -6
- package/docs/reference/classes/Base64Url.md +9 -5
- package/docs/reference/classes/BaseError.md +160 -34
- package/docs/reference/classes/BitString.md +23 -11
- package/docs/reference/classes/Coerce.md +110 -12
- package/docs/reference/classes/Compression.md +19 -11
- package/docs/reference/classes/ConflictError.md +169 -33
- package/docs/reference/classes/Converter.md +72 -28
- package/docs/reference/classes/EnvHelper.md +45 -0
- package/docs/reference/classes/ErrorHelper.md +22 -10
- package/docs/reference/classes/Factory.md +96 -18
- package/docs/reference/classes/FilenameHelper.md +6 -4
- package/docs/reference/classes/GeneralError.md +164 -32
- package/docs/reference/classes/GuardError.md +168 -32
- package/docs/reference/classes/Guards.md +398 -80
- package/docs/reference/classes/HexHelper.md +18 -8
- package/docs/reference/classes/I18n.md +46 -20
- package/docs/reference/classes/Is.md +207 -51
- package/docs/reference/classes/JsonHelper.md +146 -10
- package/docs/reference/classes/NotFoundError.md +166 -32
- package/docs/reference/classes/NotImplementedError.md +159 -29
- package/docs/reference/classes/NotSupportedError.md +163 -31
- package/docs/reference/classes/ObjectHelper.md +197 -39
- package/docs/reference/classes/RandomHelper.md +6 -4
- package/docs/reference/classes/SharedStore.md +94 -0
- package/docs/reference/classes/StringHelper.md +54 -20
- package/docs/reference/classes/Uint8ArrayHelper.md +35 -0
- package/docs/reference/classes/UnauthorizedError.md +163 -31
- package/docs/reference/classes/UnprocessableError.md +164 -32
- package/docs/reference/classes/Url.md +37 -17
- package/docs/reference/classes/Urn.md +63 -27
- package/docs/reference/classes/Validation.md +349 -135
- package/docs/reference/classes/ValidationError.md +162 -30
- package/docs/reference/index.md +7 -0
- package/docs/reference/interfaces/IComponent.md +21 -11
- package/docs/reference/interfaces/IError.md +4 -4
- package/docs/reference/interfaces/II18nShared.md +47 -0
- package/docs/reference/interfaces/IKeyValue.md +3 -1
- package/docs/reference/interfaces/ILabelledValue.md +3 -1
- package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
- package/docs/reference/interfaces/IPatchOperation.md +1 -1
- package/docs/reference/interfaces/IValidationFailure.md +1 -1
- package/docs/reference/type-aliases/CoerceType.md +5 -0
- package/docs/reference/type-aliases/CompressionType.md +1 -1
- package/docs/reference/type-aliases/ObjectOrArray.md +11 -0
- package/docs/reference/variables/CoerceType.md +67 -0
- package/docs/reference/variables/CompressionType.md +2 -2
- package/locales/en.json +14 -1
- package/package.json +7 -7
|
@@ -8,29 +8,33 @@ Class to handle errors.
|
|
|
8
8
|
|
|
9
9
|
## Constructors
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new NotImplementedError**(`source`, `method`):
|
|
13
|
+
> **new NotImplementedError**(`source`, `method`): `NotImplementedError`
|
|
14
14
|
|
|
15
15
|
Create a new instance of NotImplementedError.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### source
|
|
20
|
+
|
|
21
|
+
`string`
|
|
20
22
|
|
|
21
23
|
The source of the error.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
##### method
|
|
26
|
+
|
|
27
|
+
`string`
|
|
24
28
|
|
|
25
29
|
The method for the error.
|
|
26
30
|
|
|
27
31
|
#### Returns
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
`NotImplementedError`
|
|
30
34
|
|
|
31
35
|
#### Overrides
|
|
32
36
|
|
|
33
|
-
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#
|
|
37
|
+
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructor)
|
|
34
38
|
|
|
35
39
|
## Properties
|
|
36
40
|
|
|
@@ -54,7 +58,7 @@ Any additional information for the error.
|
|
|
54
58
|
|
|
55
59
|
#### Index Signature
|
|
56
60
|
|
|
57
|
-
|
|
61
|
+
\[`id`: `string`\]: `unknown`
|
|
58
62
|
|
|
59
63
|
#### Inherited from
|
|
60
64
|
|
|
@@ -62,15 +66,15 @@ Any additional information for the error.
|
|
|
62
66
|
|
|
63
67
|
***
|
|
64
68
|
|
|
65
|
-
###
|
|
69
|
+
### cause?
|
|
66
70
|
|
|
67
|
-
> `optional` **
|
|
71
|
+
> `optional` **cause**: [`IError`](../interfaces/IError.md)
|
|
68
72
|
|
|
69
|
-
The
|
|
73
|
+
The cause of the error.
|
|
70
74
|
|
|
71
75
|
#### Inherited from
|
|
72
76
|
|
|
73
|
-
[`BaseError`](BaseError.md).[`
|
|
77
|
+
[`BaseError`](BaseError.md).[`cause`](BaseError.md#cause)
|
|
74
78
|
|
|
75
79
|
***
|
|
76
80
|
|
|
@@ -90,7 +94,9 @@ Construct an error from an existing one.
|
|
|
90
94
|
|
|
91
95
|
#### Parameters
|
|
92
96
|
|
|
93
|
-
|
|
97
|
+
##### err
|
|
98
|
+
|
|
99
|
+
`unknown`
|
|
94
100
|
|
|
95
101
|
The existing error.
|
|
96
102
|
|
|
@@ -114,7 +120,9 @@ Flatten an error tree.
|
|
|
114
120
|
|
|
115
121
|
#### Parameters
|
|
116
122
|
|
|
117
|
-
|
|
123
|
+
##### err
|
|
124
|
+
|
|
125
|
+
`unknown`
|
|
118
126
|
|
|
119
127
|
The starting error.
|
|
120
128
|
|
|
@@ -138,10 +146,12 @@ Expand an error tree.
|
|
|
138
146
|
|
|
139
147
|
#### Parameters
|
|
140
148
|
|
|
141
|
-
|
|
149
|
+
##### errors
|
|
142
150
|
|
|
143
151
|
The list of errors to expand.
|
|
144
152
|
|
|
153
|
+
`undefined` | [`IError`](../interfaces/IError.md)[]
|
|
154
|
+
|
|
145
155
|
#### Returns
|
|
146
156
|
|
|
147
157
|
`undefined` \| [`IError`](../interfaces/IError.md)
|
|
@@ -162,14 +172,18 @@ Test to see if the error has the specified error name.
|
|
|
162
172
|
|
|
163
173
|
#### Parameters
|
|
164
174
|
|
|
165
|
-
|
|
175
|
+
##### error
|
|
176
|
+
|
|
177
|
+
`unknown`
|
|
166
178
|
|
|
167
179
|
The error to test.
|
|
168
180
|
|
|
169
|
-
|
|
181
|
+
##### name
|
|
170
182
|
|
|
171
183
|
The name to check for.
|
|
172
184
|
|
|
185
|
+
`string` | `RegExp`
|
|
186
|
+
|
|
173
187
|
#### Returns
|
|
174
188
|
|
|
175
189
|
`error is BaseError`
|
|
@@ -190,14 +204,18 @@ Test to see if the error has the specified error message.
|
|
|
190
204
|
|
|
191
205
|
#### Parameters
|
|
192
206
|
|
|
193
|
-
|
|
207
|
+
##### error
|
|
208
|
+
|
|
209
|
+
`unknown`
|
|
194
210
|
|
|
195
211
|
The error to test.
|
|
196
212
|
|
|
197
|
-
|
|
213
|
+
##### message
|
|
198
214
|
|
|
199
215
|
The message to check for.
|
|
200
216
|
|
|
217
|
+
`string` | `RegExp`
|
|
218
|
+
|
|
201
219
|
#### Returns
|
|
202
220
|
|
|
203
221
|
`error is BaseError`
|
|
@@ -218,14 +236,18 @@ Test to see if the error has the specified error code.
|
|
|
218
236
|
|
|
219
237
|
#### Parameters
|
|
220
238
|
|
|
221
|
-
|
|
239
|
+
##### error
|
|
240
|
+
|
|
241
|
+
`unknown`
|
|
222
242
|
|
|
223
243
|
The error to test.
|
|
224
244
|
|
|
225
|
-
|
|
245
|
+
##### code
|
|
226
246
|
|
|
227
247
|
The code to check for.
|
|
228
248
|
|
|
249
|
+
`string` | `RegExp`
|
|
250
|
+
|
|
229
251
|
#### Returns
|
|
230
252
|
|
|
231
253
|
`boolean`
|
|
@@ -246,14 +268,18 @@ Test to see if any of the errors or children have the given error name.
|
|
|
246
268
|
|
|
247
269
|
#### Parameters
|
|
248
270
|
|
|
249
|
-
|
|
271
|
+
##### error
|
|
272
|
+
|
|
273
|
+
`unknown`
|
|
250
274
|
|
|
251
275
|
The error to test.
|
|
252
276
|
|
|
253
|
-
|
|
277
|
+
##### name
|
|
254
278
|
|
|
255
279
|
The name to check for.
|
|
256
280
|
|
|
281
|
+
`string` | `RegExp`
|
|
282
|
+
|
|
257
283
|
#### Returns
|
|
258
284
|
|
|
259
285
|
`error is BaseError`
|
|
@@ -274,14 +300,18 @@ Test to see if any of the errors or children have the given error message.
|
|
|
274
300
|
|
|
275
301
|
#### Parameters
|
|
276
302
|
|
|
277
|
-
|
|
303
|
+
##### error
|
|
304
|
+
|
|
305
|
+
`unknown`
|
|
278
306
|
|
|
279
307
|
The error to test.
|
|
280
308
|
|
|
281
|
-
|
|
309
|
+
##### message
|
|
282
310
|
|
|
283
311
|
The message to check for.
|
|
284
312
|
|
|
313
|
+
`string` | `RegExp`
|
|
314
|
+
|
|
285
315
|
#### Returns
|
|
286
316
|
|
|
287
317
|
`error is BaseError`
|
|
@@ -302,11 +332,15 @@ Test to see if any of the errors or children are from a specific class.
|
|
|
302
332
|
|
|
303
333
|
#### Parameters
|
|
304
334
|
|
|
305
|
-
|
|
335
|
+
##### error
|
|
336
|
+
|
|
337
|
+
`unknown`
|
|
306
338
|
|
|
307
339
|
The error to test.
|
|
308
340
|
|
|
309
|
-
|
|
341
|
+
##### cls
|
|
342
|
+
|
|
343
|
+
`string`
|
|
310
344
|
|
|
311
345
|
The class to check for.
|
|
312
346
|
|
|
@@ -330,14 +364,18 @@ Test to see if any of the errors or children have the given error code.
|
|
|
330
364
|
|
|
331
365
|
#### Parameters
|
|
332
366
|
|
|
333
|
-
|
|
367
|
+
##### error
|
|
368
|
+
|
|
369
|
+
`unknown`
|
|
334
370
|
|
|
335
371
|
The error to test.
|
|
336
372
|
|
|
337
|
-
|
|
373
|
+
##### code
|
|
338
374
|
|
|
339
375
|
The code to check for.
|
|
340
376
|
|
|
377
|
+
`string` | `RegExp`
|
|
378
|
+
|
|
341
379
|
#### Returns
|
|
342
380
|
|
|
343
381
|
`error is BaseError`
|
|
@@ -350,12 +388,104 @@ True if the error has the name.
|
|
|
350
388
|
|
|
351
389
|
***
|
|
352
390
|
|
|
391
|
+
### isEmpty()
|
|
392
|
+
|
|
393
|
+
> `static` **isEmpty**(`err`): `boolean`
|
|
394
|
+
|
|
395
|
+
Is the error empty, i.e. does it have no message, source, properties, or cause?
|
|
396
|
+
|
|
397
|
+
#### Parameters
|
|
398
|
+
|
|
399
|
+
##### err
|
|
400
|
+
|
|
401
|
+
[`IError`](../interfaces/IError.md)
|
|
402
|
+
|
|
403
|
+
The error to check for being empty.
|
|
404
|
+
|
|
405
|
+
#### Returns
|
|
406
|
+
|
|
407
|
+
`boolean`
|
|
408
|
+
|
|
409
|
+
True if the error is empty.
|
|
410
|
+
|
|
411
|
+
#### Inherited from
|
|
412
|
+
|
|
413
|
+
[`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
|
|
414
|
+
|
|
415
|
+
***
|
|
416
|
+
|
|
417
|
+
### isAggregateError()
|
|
418
|
+
|
|
419
|
+
> `static` **isAggregateError**(`err`): `err is AggregateError`
|
|
420
|
+
|
|
421
|
+
Is the error an aggregate error.
|
|
422
|
+
|
|
423
|
+
#### Parameters
|
|
424
|
+
|
|
425
|
+
##### err
|
|
426
|
+
|
|
427
|
+
`unknown`
|
|
428
|
+
|
|
429
|
+
The error to check for being an aggregate error.
|
|
430
|
+
|
|
431
|
+
#### Returns
|
|
432
|
+
|
|
433
|
+
`err is AggregateError`
|
|
434
|
+
|
|
435
|
+
True if the error is an aggregate error.
|
|
436
|
+
|
|
437
|
+
#### Inherited from
|
|
438
|
+
|
|
439
|
+
[`BaseError`](BaseError.md).[`isAggregateError`](BaseError.md#isaggregateerror)
|
|
440
|
+
|
|
441
|
+
***
|
|
442
|
+
|
|
443
|
+
### fromAggregate()
|
|
444
|
+
|
|
445
|
+
> `static` **fromAggregate**(`err`, `includeStackTrace?`): [`IError`](../interfaces/IError.md)[]
|
|
446
|
+
|
|
447
|
+
Convert the aggregate error to an array of errors.
|
|
448
|
+
|
|
449
|
+
#### Parameters
|
|
450
|
+
|
|
451
|
+
##### err
|
|
452
|
+
|
|
453
|
+
`unknown`
|
|
454
|
+
|
|
455
|
+
The error to convert.
|
|
456
|
+
|
|
457
|
+
##### includeStackTrace?
|
|
458
|
+
|
|
459
|
+
`boolean`
|
|
460
|
+
|
|
461
|
+
Whether to include the error stack in the model, defaults to false.
|
|
462
|
+
|
|
463
|
+
#### Returns
|
|
464
|
+
|
|
465
|
+
[`IError`](../interfaces/IError.md)[]
|
|
466
|
+
|
|
467
|
+
The array of errors.
|
|
468
|
+
|
|
469
|
+
#### Inherited from
|
|
470
|
+
|
|
471
|
+
[`BaseError`](BaseError.md).[`fromAggregate`](BaseError.md#fromaggregate)
|
|
472
|
+
|
|
473
|
+
***
|
|
474
|
+
|
|
353
475
|
### toJsonObject()
|
|
354
476
|
|
|
355
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
477
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
356
478
|
|
|
357
479
|
Serialize the error to the error model.
|
|
358
480
|
|
|
481
|
+
#### Parameters
|
|
482
|
+
|
|
483
|
+
##### includeStackTrace?
|
|
484
|
+
|
|
485
|
+
`boolean`
|
|
486
|
+
|
|
487
|
+
Whether to include the error stack in the model, defaults to false.
|
|
488
|
+
|
|
359
489
|
#### Returns
|
|
360
490
|
|
|
361
491
|
[`IError`](../interfaces/IError.md)
|
|
@@ -8,33 +8,39 @@ Class to handle errors when a feature is unsupported.
|
|
|
8
8
|
|
|
9
9
|
## Constructors
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new NotSupportedError**(`source`, `message`, `
|
|
13
|
+
> **new NotSupportedError**(`source`, `message`, `cause?`): `NotSupportedError`
|
|
14
14
|
|
|
15
15
|
Create a new instance of NotSupportedError.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### source
|
|
20
|
+
|
|
21
|
+
`string`
|
|
20
22
|
|
|
21
23
|
The source of the error.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
##### message
|
|
26
|
+
|
|
27
|
+
`string`
|
|
24
28
|
|
|
25
29
|
The message as a code.
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
##### cause?
|
|
32
|
+
|
|
33
|
+
`unknown`
|
|
28
34
|
|
|
29
|
-
The
|
|
35
|
+
The cause of the error if we have wrapped another error.
|
|
30
36
|
|
|
31
37
|
#### Returns
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
`NotSupportedError`
|
|
34
40
|
|
|
35
41
|
#### Overrides
|
|
36
42
|
|
|
37
|
-
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#
|
|
43
|
+
[`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructor)
|
|
38
44
|
|
|
39
45
|
## Properties
|
|
40
46
|
|
|
@@ -58,7 +64,7 @@ Any additional information for the error.
|
|
|
58
64
|
|
|
59
65
|
#### Index Signature
|
|
60
66
|
|
|
61
|
-
|
|
67
|
+
\[`id`: `string`\]: `unknown`
|
|
62
68
|
|
|
63
69
|
#### Inherited from
|
|
64
70
|
|
|
@@ -66,15 +72,15 @@ Any additional information for the error.
|
|
|
66
72
|
|
|
67
73
|
***
|
|
68
74
|
|
|
69
|
-
###
|
|
75
|
+
### cause?
|
|
70
76
|
|
|
71
|
-
> `optional` **
|
|
77
|
+
> `optional` **cause**: [`IError`](../interfaces/IError.md)
|
|
72
78
|
|
|
73
|
-
The
|
|
79
|
+
The cause of the error.
|
|
74
80
|
|
|
75
81
|
#### Inherited from
|
|
76
82
|
|
|
77
|
-
[`BaseError`](BaseError.md).[`
|
|
83
|
+
[`BaseError`](BaseError.md).[`cause`](BaseError.md#cause)
|
|
78
84
|
|
|
79
85
|
***
|
|
80
86
|
|
|
@@ -94,7 +100,9 @@ Construct an error from an existing one.
|
|
|
94
100
|
|
|
95
101
|
#### Parameters
|
|
96
102
|
|
|
97
|
-
|
|
103
|
+
##### err
|
|
104
|
+
|
|
105
|
+
`unknown`
|
|
98
106
|
|
|
99
107
|
The existing error.
|
|
100
108
|
|
|
@@ -118,7 +126,9 @@ Flatten an error tree.
|
|
|
118
126
|
|
|
119
127
|
#### Parameters
|
|
120
128
|
|
|
121
|
-
|
|
129
|
+
##### err
|
|
130
|
+
|
|
131
|
+
`unknown`
|
|
122
132
|
|
|
123
133
|
The starting error.
|
|
124
134
|
|
|
@@ -142,10 +152,12 @@ Expand an error tree.
|
|
|
142
152
|
|
|
143
153
|
#### Parameters
|
|
144
154
|
|
|
145
|
-
|
|
155
|
+
##### errors
|
|
146
156
|
|
|
147
157
|
The list of errors to expand.
|
|
148
158
|
|
|
159
|
+
`undefined` | [`IError`](../interfaces/IError.md)[]
|
|
160
|
+
|
|
149
161
|
#### Returns
|
|
150
162
|
|
|
151
163
|
`undefined` \| [`IError`](../interfaces/IError.md)
|
|
@@ -166,14 +178,18 @@ Test to see if the error has the specified error name.
|
|
|
166
178
|
|
|
167
179
|
#### Parameters
|
|
168
180
|
|
|
169
|
-
|
|
181
|
+
##### error
|
|
182
|
+
|
|
183
|
+
`unknown`
|
|
170
184
|
|
|
171
185
|
The error to test.
|
|
172
186
|
|
|
173
|
-
|
|
187
|
+
##### name
|
|
174
188
|
|
|
175
189
|
The name to check for.
|
|
176
190
|
|
|
191
|
+
`string` | `RegExp`
|
|
192
|
+
|
|
177
193
|
#### Returns
|
|
178
194
|
|
|
179
195
|
`error is BaseError`
|
|
@@ -194,14 +210,18 @@ Test to see if the error has the specified error message.
|
|
|
194
210
|
|
|
195
211
|
#### Parameters
|
|
196
212
|
|
|
197
|
-
|
|
213
|
+
##### error
|
|
214
|
+
|
|
215
|
+
`unknown`
|
|
198
216
|
|
|
199
217
|
The error to test.
|
|
200
218
|
|
|
201
|
-
|
|
219
|
+
##### message
|
|
202
220
|
|
|
203
221
|
The message to check for.
|
|
204
222
|
|
|
223
|
+
`string` | `RegExp`
|
|
224
|
+
|
|
205
225
|
#### Returns
|
|
206
226
|
|
|
207
227
|
`error is BaseError`
|
|
@@ -222,14 +242,18 @@ Test to see if the error has the specified error code.
|
|
|
222
242
|
|
|
223
243
|
#### Parameters
|
|
224
244
|
|
|
225
|
-
|
|
245
|
+
##### error
|
|
246
|
+
|
|
247
|
+
`unknown`
|
|
226
248
|
|
|
227
249
|
The error to test.
|
|
228
250
|
|
|
229
|
-
|
|
251
|
+
##### code
|
|
230
252
|
|
|
231
253
|
The code to check for.
|
|
232
254
|
|
|
255
|
+
`string` | `RegExp`
|
|
256
|
+
|
|
233
257
|
#### Returns
|
|
234
258
|
|
|
235
259
|
`boolean`
|
|
@@ -250,14 +274,18 @@ Test to see if any of the errors or children have the given error name.
|
|
|
250
274
|
|
|
251
275
|
#### Parameters
|
|
252
276
|
|
|
253
|
-
|
|
277
|
+
##### error
|
|
278
|
+
|
|
279
|
+
`unknown`
|
|
254
280
|
|
|
255
281
|
The error to test.
|
|
256
282
|
|
|
257
|
-
|
|
283
|
+
##### name
|
|
258
284
|
|
|
259
285
|
The name to check for.
|
|
260
286
|
|
|
287
|
+
`string` | `RegExp`
|
|
288
|
+
|
|
261
289
|
#### Returns
|
|
262
290
|
|
|
263
291
|
`error is BaseError`
|
|
@@ -278,14 +306,18 @@ Test to see if any of the errors or children have the given error message.
|
|
|
278
306
|
|
|
279
307
|
#### Parameters
|
|
280
308
|
|
|
281
|
-
|
|
309
|
+
##### error
|
|
310
|
+
|
|
311
|
+
`unknown`
|
|
282
312
|
|
|
283
313
|
The error to test.
|
|
284
314
|
|
|
285
|
-
|
|
315
|
+
##### message
|
|
286
316
|
|
|
287
317
|
The message to check for.
|
|
288
318
|
|
|
319
|
+
`string` | `RegExp`
|
|
320
|
+
|
|
289
321
|
#### Returns
|
|
290
322
|
|
|
291
323
|
`error is BaseError`
|
|
@@ -306,11 +338,15 @@ Test to see if any of the errors or children are from a specific class.
|
|
|
306
338
|
|
|
307
339
|
#### Parameters
|
|
308
340
|
|
|
309
|
-
|
|
341
|
+
##### error
|
|
342
|
+
|
|
343
|
+
`unknown`
|
|
310
344
|
|
|
311
345
|
The error to test.
|
|
312
346
|
|
|
313
|
-
|
|
347
|
+
##### cls
|
|
348
|
+
|
|
349
|
+
`string`
|
|
314
350
|
|
|
315
351
|
The class to check for.
|
|
316
352
|
|
|
@@ -334,14 +370,18 @@ Test to see if any of the errors or children have the given error code.
|
|
|
334
370
|
|
|
335
371
|
#### Parameters
|
|
336
372
|
|
|
337
|
-
|
|
373
|
+
##### error
|
|
374
|
+
|
|
375
|
+
`unknown`
|
|
338
376
|
|
|
339
377
|
The error to test.
|
|
340
378
|
|
|
341
|
-
|
|
379
|
+
##### code
|
|
342
380
|
|
|
343
381
|
The code to check for.
|
|
344
382
|
|
|
383
|
+
`string` | `RegExp`
|
|
384
|
+
|
|
345
385
|
#### Returns
|
|
346
386
|
|
|
347
387
|
`error is BaseError`
|
|
@@ -354,12 +394,104 @@ True if the error has the name.
|
|
|
354
394
|
|
|
355
395
|
***
|
|
356
396
|
|
|
397
|
+
### isEmpty()
|
|
398
|
+
|
|
399
|
+
> `static` **isEmpty**(`err`): `boolean`
|
|
400
|
+
|
|
401
|
+
Is the error empty, i.e. does it have no message, source, properties, or cause?
|
|
402
|
+
|
|
403
|
+
#### Parameters
|
|
404
|
+
|
|
405
|
+
##### err
|
|
406
|
+
|
|
407
|
+
[`IError`](../interfaces/IError.md)
|
|
408
|
+
|
|
409
|
+
The error to check for being empty.
|
|
410
|
+
|
|
411
|
+
#### Returns
|
|
412
|
+
|
|
413
|
+
`boolean`
|
|
414
|
+
|
|
415
|
+
True if the error is empty.
|
|
416
|
+
|
|
417
|
+
#### Inherited from
|
|
418
|
+
|
|
419
|
+
[`BaseError`](BaseError.md).[`isEmpty`](BaseError.md#isempty)
|
|
420
|
+
|
|
421
|
+
***
|
|
422
|
+
|
|
423
|
+
### isAggregateError()
|
|
424
|
+
|
|
425
|
+
> `static` **isAggregateError**(`err`): `err is AggregateError`
|
|
426
|
+
|
|
427
|
+
Is the error an aggregate error.
|
|
428
|
+
|
|
429
|
+
#### Parameters
|
|
430
|
+
|
|
431
|
+
##### err
|
|
432
|
+
|
|
433
|
+
`unknown`
|
|
434
|
+
|
|
435
|
+
The error to check for being an aggregate error.
|
|
436
|
+
|
|
437
|
+
#### Returns
|
|
438
|
+
|
|
439
|
+
`err is AggregateError`
|
|
440
|
+
|
|
441
|
+
True if the error is an aggregate error.
|
|
442
|
+
|
|
443
|
+
#### Inherited from
|
|
444
|
+
|
|
445
|
+
[`BaseError`](BaseError.md).[`isAggregateError`](BaseError.md#isaggregateerror)
|
|
446
|
+
|
|
447
|
+
***
|
|
448
|
+
|
|
449
|
+
### fromAggregate()
|
|
450
|
+
|
|
451
|
+
> `static` **fromAggregate**(`err`, `includeStackTrace?`): [`IError`](../interfaces/IError.md)[]
|
|
452
|
+
|
|
453
|
+
Convert the aggregate error to an array of errors.
|
|
454
|
+
|
|
455
|
+
#### Parameters
|
|
456
|
+
|
|
457
|
+
##### err
|
|
458
|
+
|
|
459
|
+
`unknown`
|
|
460
|
+
|
|
461
|
+
The error to convert.
|
|
462
|
+
|
|
463
|
+
##### includeStackTrace?
|
|
464
|
+
|
|
465
|
+
`boolean`
|
|
466
|
+
|
|
467
|
+
Whether to include the error stack in the model, defaults to false.
|
|
468
|
+
|
|
469
|
+
#### Returns
|
|
470
|
+
|
|
471
|
+
[`IError`](../interfaces/IError.md)[]
|
|
472
|
+
|
|
473
|
+
The array of errors.
|
|
474
|
+
|
|
475
|
+
#### Inherited from
|
|
476
|
+
|
|
477
|
+
[`BaseError`](BaseError.md).[`fromAggregate`](BaseError.md#fromaggregate)
|
|
478
|
+
|
|
479
|
+
***
|
|
480
|
+
|
|
357
481
|
### toJsonObject()
|
|
358
482
|
|
|
359
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
483
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
360
484
|
|
|
361
485
|
Serialize the error to the error model.
|
|
362
486
|
|
|
487
|
+
#### Parameters
|
|
488
|
+
|
|
489
|
+
##### includeStackTrace?
|
|
490
|
+
|
|
491
|
+
`boolean`
|
|
492
|
+
|
|
493
|
+
Whether to include the error stack in the model, defaults to false.
|
|
494
|
+
|
|
363
495
|
#### Returns
|
|
364
496
|
|
|
365
497
|
[`IError`](../interfaces/IError.md)
|