@twin.org/core 0.0.1-next.58 → 0.0.1-next.59
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 +4 -3
- package/dist/esm/index.mjs +4 -3
- package/dist/types/errors/baseError.d.ts +2 -1
- package/docs/changelog.md +8 -0
- package/docs/reference/classes/AlreadyExistsError.md +9 -1
- package/docs/reference/classes/BaseError.md +9 -1
- package/docs/reference/classes/ConflictError.md +9 -1
- package/docs/reference/classes/GeneralError.md +9 -1
- package/docs/reference/classes/GuardError.md +9 -1
- package/docs/reference/classes/NotFoundError.md +9 -1
- package/docs/reference/classes/NotImplementedError.md +9 -1
- package/docs/reference/classes/NotSupportedError.md +9 -1
- package/docs/reference/classes/UnauthorizedError.md +9 -1
- package/docs/reference/classes/UnprocessableError.md +9 -1
- package/docs/reference/classes/ValidationError.md +9 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -805,9 +805,10 @@ class BaseError extends Error {
|
|
|
805
805
|
}
|
|
806
806
|
/**
|
|
807
807
|
* Serialize the error to the error model.
|
|
808
|
+
* @param includeStackTrace Whether to include the error stack in the model, defaults to false.
|
|
808
809
|
* @returns The error model.
|
|
809
810
|
*/
|
|
810
|
-
toJsonObject() {
|
|
811
|
+
toJsonObject(includeStackTrace) {
|
|
811
812
|
const err = {};
|
|
812
813
|
if (Is.stringValue(this.name)) {
|
|
813
814
|
err.name = this.name;
|
|
@@ -821,11 +822,11 @@ class BaseError extends Error {
|
|
|
821
822
|
if (Is.object(this.properties)) {
|
|
822
823
|
err.properties = this.properties;
|
|
823
824
|
}
|
|
824
|
-
if (Is.stringValue(this.stack)) {
|
|
825
|
+
if ((includeStackTrace ?? false) && Is.stringValue(this.stack)) {
|
|
825
826
|
err.stack = this.stack;
|
|
826
827
|
}
|
|
827
828
|
if (Is.notEmpty(this.inner)) {
|
|
828
|
-
err.inner = BaseError.fromError(this.inner).toJsonObject();
|
|
829
|
+
err.inner = BaseError.fromError(this.inner).toJsonObject(includeStackTrace);
|
|
829
830
|
}
|
|
830
831
|
return err;
|
|
831
832
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -803,9 +803,10 @@ class BaseError extends Error {
|
|
|
803
803
|
}
|
|
804
804
|
/**
|
|
805
805
|
* Serialize the error to the error model.
|
|
806
|
+
* @param includeStackTrace Whether to include the error stack in the model, defaults to false.
|
|
806
807
|
* @returns The error model.
|
|
807
808
|
*/
|
|
808
|
-
toJsonObject() {
|
|
809
|
+
toJsonObject(includeStackTrace) {
|
|
809
810
|
const err = {};
|
|
810
811
|
if (Is.stringValue(this.name)) {
|
|
811
812
|
err.name = this.name;
|
|
@@ -819,11 +820,11 @@ class BaseError extends Error {
|
|
|
819
820
|
if (Is.object(this.properties)) {
|
|
820
821
|
err.properties = this.properties;
|
|
821
822
|
}
|
|
822
|
-
if (Is.stringValue(this.stack)) {
|
|
823
|
+
if ((includeStackTrace ?? false) && Is.stringValue(this.stack)) {
|
|
823
824
|
err.stack = this.stack;
|
|
824
825
|
}
|
|
825
826
|
if (Is.notEmpty(this.inner)) {
|
|
826
|
-
err.inner = BaseError.fromError(this.inner).toJsonObject();
|
|
827
|
+
err.inner = BaseError.fromError(this.inner).toJsonObject(includeStackTrace);
|
|
827
828
|
}
|
|
828
829
|
return err;
|
|
829
830
|
}
|
|
@@ -97,7 +97,8 @@ export declare class BaseError extends Error implements IError {
|
|
|
97
97
|
static someErrorCode(error: unknown, code: string | RegExp): error is BaseError;
|
|
98
98
|
/**
|
|
99
99
|
* Serialize the error to the error model.
|
|
100
|
+
* @param includeStackTrace Whether to include the error stack in the model, defaults to false.
|
|
100
101
|
* @returns The error model.
|
|
101
102
|
*/
|
|
102
|
-
toJsonObject(): IError;
|
|
103
|
+
toJsonObject(includeStackTrace?: boolean): IError;
|
|
103
104
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @twin.org/core - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.1-next.59](https://github.com/twinfoundation/framework/compare/core-v0.0.1-next.58...core-v0.0.1-next.59) (2025-06-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* propagate includeStackTrace on error conversion ([8471cbb](https://github.com/twinfoundation/framework/commit/8471cbb71f8fc98247a0e92126c438c1a8b04d9b))
|
|
9
|
+
* propagate includeStackTrace on error conversion ([818337d](https://github.com/twinfoundation/framework/commit/818337d50d14bf5a7e8b3204649aa7527115cca9))
|
|
10
|
+
|
|
3
11
|
## [0.0.1-next.58](https://github.com/twinfoundation/framework/compare/core-v0.0.1-next.57...core-v0.0.1-next.58) (2025-06-13)
|
|
4
12
|
|
|
5
13
|
|
|
@@ -402,10 +402,18 @@ True if the error has the name.
|
|
|
402
402
|
|
|
403
403
|
### toJsonObject()
|
|
404
404
|
|
|
405
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
405
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
406
406
|
|
|
407
407
|
Serialize the error to the error model.
|
|
408
408
|
|
|
409
|
+
#### Parameters
|
|
410
|
+
|
|
411
|
+
##### includeStackTrace?
|
|
412
|
+
|
|
413
|
+
`boolean`
|
|
414
|
+
|
|
415
|
+
Whether to include the error stack in the model, defaults to false.
|
|
416
|
+
|
|
409
417
|
#### Returns
|
|
410
418
|
|
|
411
419
|
[`IError`](../interfaces/IError.md)
|
|
@@ -375,10 +375,18 @@ True if the error has the name.
|
|
|
375
375
|
|
|
376
376
|
### toJsonObject()
|
|
377
377
|
|
|
378
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
378
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
379
379
|
|
|
380
380
|
Serialize the error to the error model.
|
|
381
381
|
|
|
382
|
+
#### Parameters
|
|
383
|
+
|
|
384
|
+
##### includeStackTrace?
|
|
385
|
+
|
|
386
|
+
`boolean`
|
|
387
|
+
|
|
388
|
+
Whether to include the error stack in the model, defaults to false.
|
|
389
|
+
|
|
382
390
|
#### Returns
|
|
383
391
|
|
|
384
392
|
[`IError`](../interfaces/IError.md)
|
|
@@ -408,10 +408,18 @@ True if the error has the name.
|
|
|
408
408
|
|
|
409
409
|
### toJsonObject()
|
|
410
410
|
|
|
411
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
411
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
412
412
|
|
|
413
413
|
Serialize the error to the error model.
|
|
414
414
|
|
|
415
|
+
#### Parameters
|
|
416
|
+
|
|
417
|
+
##### includeStackTrace?
|
|
418
|
+
|
|
419
|
+
`boolean`
|
|
420
|
+
|
|
421
|
+
Whether to include the error stack in the model, defaults to false.
|
|
422
|
+
|
|
415
423
|
#### Returns
|
|
416
424
|
|
|
417
425
|
[`IError`](../interfaces/IError.md)
|
|
@@ -400,10 +400,18 @@ True if the error has the name.
|
|
|
400
400
|
|
|
401
401
|
### toJsonObject()
|
|
402
402
|
|
|
403
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
403
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
404
404
|
|
|
405
405
|
Serialize the error to the error model.
|
|
406
406
|
|
|
407
|
+
#### Parameters
|
|
408
|
+
|
|
409
|
+
##### includeStackTrace?
|
|
410
|
+
|
|
411
|
+
`boolean`
|
|
412
|
+
|
|
413
|
+
Whether to include the error stack in the model, defaults to false.
|
|
414
|
+
|
|
407
415
|
#### Returns
|
|
408
416
|
|
|
409
417
|
[`IError`](../interfaces/IError.md)
|
|
@@ -408,10 +408,18 @@ True if the error has the name.
|
|
|
408
408
|
|
|
409
409
|
### toJsonObject()
|
|
410
410
|
|
|
411
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
411
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
412
412
|
|
|
413
413
|
Serialize the error to the error model.
|
|
414
414
|
|
|
415
|
+
#### Parameters
|
|
416
|
+
|
|
417
|
+
##### includeStackTrace?
|
|
418
|
+
|
|
419
|
+
`boolean`
|
|
420
|
+
|
|
421
|
+
Whether to include the error stack in the model, defaults to false.
|
|
422
|
+
|
|
415
423
|
#### Returns
|
|
416
424
|
|
|
417
425
|
[`IError`](../interfaces/IError.md)
|
|
@@ -402,10 +402,18 @@ True if the error has the name.
|
|
|
402
402
|
|
|
403
403
|
### toJsonObject()
|
|
404
404
|
|
|
405
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
405
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
406
406
|
|
|
407
407
|
Serialize the error to the error model.
|
|
408
408
|
|
|
409
|
+
#### Parameters
|
|
410
|
+
|
|
411
|
+
##### includeStackTrace?
|
|
412
|
+
|
|
413
|
+
`boolean`
|
|
414
|
+
|
|
415
|
+
Whether to include the error stack in the model, defaults to false.
|
|
416
|
+
|
|
409
417
|
#### Returns
|
|
410
418
|
|
|
411
419
|
[`IError`](../interfaces/IError.md)
|
|
@@ -390,10 +390,18 @@ True if the error has the name.
|
|
|
390
390
|
|
|
391
391
|
### toJsonObject()
|
|
392
392
|
|
|
393
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
393
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
394
394
|
|
|
395
395
|
Serialize the error to the error model.
|
|
396
396
|
|
|
397
|
+
#### Parameters
|
|
398
|
+
|
|
399
|
+
##### includeStackTrace?
|
|
400
|
+
|
|
401
|
+
`boolean`
|
|
402
|
+
|
|
403
|
+
Whether to include the error stack in the model, defaults to false.
|
|
404
|
+
|
|
397
405
|
#### Returns
|
|
398
406
|
|
|
399
407
|
[`IError`](../interfaces/IError.md)
|
|
@@ -396,10 +396,18 @@ True if the error has the name.
|
|
|
396
396
|
|
|
397
397
|
### toJsonObject()
|
|
398
398
|
|
|
399
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
399
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
400
400
|
|
|
401
401
|
Serialize the error to the error model.
|
|
402
402
|
|
|
403
|
+
#### Parameters
|
|
404
|
+
|
|
405
|
+
##### includeStackTrace?
|
|
406
|
+
|
|
407
|
+
`boolean`
|
|
408
|
+
|
|
409
|
+
Whether to include the error stack in the model, defaults to false.
|
|
410
|
+
|
|
403
411
|
#### Returns
|
|
404
412
|
|
|
405
413
|
[`IError`](../interfaces/IError.md)
|
|
@@ -396,10 +396,18 @@ True if the error has the name.
|
|
|
396
396
|
|
|
397
397
|
### toJsonObject()
|
|
398
398
|
|
|
399
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
399
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
400
400
|
|
|
401
401
|
Serialize the error to the error model.
|
|
402
402
|
|
|
403
|
+
#### Parameters
|
|
404
|
+
|
|
405
|
+
##### includeStackTrace?
|
|
406
|
+
|
|
407
|
+
`boolean`
|
|
408
|
+
|
|
409
|
+
Whether to include the error stack in the model, defaults to false.
|
|
410
|
+
|
|
403
411
|
#### Returns
|
|
404
412
|
|
|
405
413
|
[`IError`](../interfaces/IError.md)
|
|
@@ -400,10 +400,18 @@ True if the error has the name.
|
|
|
400
400
|
|
|
401
401
|
### toJsonObject()
|
|
402
402
|
|
|
403
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
403
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
404
404
|
|
|
405
405
|
Serialize the error to the error model.
|
|
406
406
|
|
|
407
|
+
#### Parameters
|
|
408
|
+
|
|
409
|
+
##### includeStackTrace?
|
|
410
|
+
|
|
411
|
+
`boolean`
|
|
412
|
+
|
|
413
|
+
Whether to include the error stack in the model, defaults to false.
|
|
414
|
+
|
|
407
415
|
#### Returns
|
|
408
416
|
|
|
409
417
|
[`IError`](../interfaces/IError.md)
|
|
@@ -396,10 +396,18 @@ True if the error has the name.
|
|
|
396
396
|
|
|
397
397
|
### toJsonObject()
|
|
398
398
|
|
|
399
|
-
> **toJsonObject**(): [`IError`](../interfaces/IError.md)
|
|
399
|
+
> **toJsonObject**(`includeStackTrace?`): [`IError`](../interfaces/IError.md)
|
|
400
400
|
|
|
401
401
|
Serialize the error to the error model.
|
|
402
402
|
|
|
403
|
+
#### Parameters
|
|
404
|
+
|
|
405
|
+
##### includeStackTrace?
|
|
406
|
+
|
|
407
|
+
`boolean`
|
|
408
|
+
|
|
409
|
+
Whether to include the error stack in the model, defaults to false.
|
|
410
|
+
|
|
403
411
|
#### Returns
|
|
404
412
|
|
|
405
413
|
[`IError`](../interfaces/IError.md)
|