@hg-ts/exception 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/consts.js +1 -4
- package/dist/consts.js.map +1 -1
- package/dist/exception.factory.d.ts +1 -1
- package/dist/exception.factory.d.ts.map +1 -1
- package/dist/exception.factory.js +10 -14
- package/dist/exception.factory.js.map +1 -1
- package/dist/exceptions/aggregate-error.exception.d.ts +1 -1
- package/dist/exceptions/aggregate-error.exception.d.ts.map +1 -1
- package/dist/exceptions/aggregate-error.exception.js +5 -9
- package/dist/exceptions/aggregate-error.exception.js.map +1 -1
- package/dist/exceptions/base.aggregate.exception.d.ts +1 -1
- package/dist/exceptions/base.aggregate.exception.d.ts.map +1 -1
- package/dist/exceptions/base.aggregate.exception.js +6 -10
- package/dist/exceptions/base.aggregate.exception.js.map +1 -1
- package/dist/exceptions/base.exception.d.ts +1 -1
- package/dist/exceptions/base.exception.d.ts.map +1 -1
- package/dist/exceptions/base.exception.js +11 -16
- package/dist/exceptions/base.exception.js.map +1 -1
- package/dist/exceptions/error.exception.d.ts +1 -1
- package/dist/exceptions/error.exception.d.ts.map +1 -1
- package/dist/exceptions/error.exception.js +2 -6
- package/dist/exceptions/error.exception.js.map +1 -1
- package/dist/exceptions/forbidden.exception.d.ts +1 -1
- package/dist/exceptions/forbidden.exception.d.ts.map +1 -1
- package/dist/exceptions/forbidden.exception.js +2 -6
- package/dist/exceptions/forbidden.exception.js.map +1 -1
- package/dist/exceptions/index.d.ts +9 -9
- package/dist/exceptions/index.d.ts.map +1 -1
- package/dist/exceptions/index.js +9 -12
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/invalid-input.exception.d.ts +1 -1
- package/dist/exceptions/invalid-input.exception.d.ts.map +1 -1
- package/dist/exceptions/invalid-input.exception.js +2 -6
- package/dist/exceptions/invalid-input.exception.js.map +1 -1
- package/dist/exceptions/not-implemented.exception.d.ts +1 -1
- package/dist/exceptions/not-implemented.exception.d.ts.map +1 -1
- package/dist/exceptions/not-implemented.exception.js +2 -6
- package/dist/exceptions/not-implemented.exception.js.map +1 -1
- package/dist/exceptions/unknown.exception.d.ts +1 -1
- package/dist/exceptions/unknown.exception.d.ts.map +1 -1
- package/dist/exceptions/unknown.exception.js +2 -6
- package/dist/exceptions/unknown.exception.js.map +1 -1
- package/dist/exceptions/will-never-happened.exception.d.ts +1 -1
- package/dist/exceptions/will-never-happened.exception.d.ts.map +1 -1
- package/dist/exceptions/will-never-happened.exception.js +2 -6
- package/dist/exceptions/will-never-happened.exception.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/tests/serialization.test.js +85 -88
- package/dist/tests/serialization.test.js.map +1 -1
- package/dist/tests/test.aggregate-exception.d.ts +1 -1
- package/dist/tests/test.aggregate-exception.d.ts.map +1 -1
- package/dist/tests/test.aggregate-exception.js +6 -10
- package/dist/tests/test.aggregate-exception.js.map +1 -1
- package/dist/tests/test.exception.d.ts +1 -1
- package/dist/tests/test.exception.d.ts.map +1 -1
- package/dist/tests/test.exception.js +2 -6
- package/dist/tests/test.exception.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/stack-trace.formatter.js +5 -10
- package/dist/utils/stack-trace.formatter.js.map +1 -1
- package/package.json +6 -5
- package/tsconfig.json +1 -1
package/dist/consts.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SOURCE_MAP_ENABLED = void 0;
|
|
4
|
-
exports.SOURCE_MAP_ENABLED = !!(new Error().stack?.includes('->'));
|
|
1
|
+
export const SOURCE_MAP_ENABLED = !!(new Error().stack?.includes('->'));
|
|
5
2
|
//# sourceMappingURL=consts.js.map
|
package/dist/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseException, JSONBaseException } from './exceptions';
|
|
1
|
+
import { BaseException, JSONBaseException } from './exceptions/index.js';
|
|
2
2
|
export declare class ExceptionFactory {
|
|
3
3
|
private constructor();
|
|
4
4
|
static fromJson<T extends JSONBaseException>(json: T, ctorList: Class<BaseException, any[]>[]): BaseException;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception.factory.d.ts","sourceRoot":"","sources":["../src/exception.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,EAIb,iBAAiB,EAIjB,MAAM,
|
|
1
|
+
{"version":3,"file":"exception.factory.d.ts","sourceRoot":"","sources":["../src/exception.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,aAAa,EAIb,iBAAiB,EAIjB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,gBAAgB;IAC5B,OAAO;WAEO,QAAQ,CAAC,CAAC,SAAS,iBAAiB,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,aAAa;CAyBpH"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ExceptionFactory = void 0;
|
|
4
|
-
const exceptions_1 = require("./exceptions");
|
|
5
|
-
class ExceptionFactory {
|
|
1
|
+
import { AggregateErrorException, ErrorException, ForbiddenException, InvalidInputException, NotImplementedException, UnknownException, WillNeverHappenedException, } from './exceptions/index.js';
|
|
2
|
+
export class ExceptionFactory {
|
|
6
3
|
constructor() { }
|
|
7
4
|
static fromJson(json, ctorList) {
|
|
8
5
|
const ctorToMap = [
|
|
9
6
|
...ctorList,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
AggregateErrorException,
|
|
8
|
+
ErrorException,
|
|
9
|
+
ForbiddenException,
|
|
10
|
+
InvalidInputException,
|
|
11
|
+
NotImplementedException,
|
|
12
|
+
UnknownException,
|
|
13
|
+
WillNeverHappenedException,
|
|
17
14
|
];
|
|
18
15
|
for (const ctor of ctorToMap) {
|
|
19
16
|
const { name, ...exceptionData } = json;
|
|
@@ -24,8 +21,7 @@ class ExceptionFactory {
|
|
|
24
21
|
return exception;
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
throw new
|
|
24
|
+
throw new InvalidInputException(`Exception constructor with name "${json.name}" not passed`);
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
|
-
exports.ExceptionFactory = ExceptionFactory;
|
|
31
27
|
//# sourceMappingURL=exception.factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception.factory.js","sourceRoot":"","sources":["../src/exception.factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"exception.factory.js","sourceRoot":"","sources":["../src/exception.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,uBAAuB,EAEvB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EAErB,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,GAC1B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,OAAO,gBAAgB;IAC5B,gBAAuB,CAAC;IAEjB,MAAM,CAAC,QAAQ,CAA8B,IAAO,EAAE,QAAuC;QACnG,MAAM,SAAS,GAAG;YACjB,GAAG,QAAQ;YACX,uBAAuB;YACvB,cAAc;YACd,kBAAkB;YAClB,qBAAqB;YACrB,uBAAuB;YACvB,gBAAgB;YAChB,0BAA0B;SAC1B,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,GAAG,IAAI,CAAC;YACxC,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBACxB,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAEhD,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;gBACxC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;gBAE/C,OAAO,SAAS,CAAC;YAClB,CAAC;QACF,CAAC;QAED,MAAM,IAAI,qBAAqB,CAAC,oCAAoC,IAAI,CAAC,IAAI,cAAc,CAAC,CAAC;IAC9F,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-error.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/aggregate-error.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"aggregate-error.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/aggregate-error.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,qBAAa,uBAAwB,SAAQ,sBAAsB;gBAC/C,KAAK,EAAE,cAAc;CAqBxC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const base_aggregate_exception_1 = require("./base.aggregate.exception");
|
|
5
|
-
const base_exception_1 = require("./base.exception");
|
|
6
|
-
class AggregateErrorException extends base_aggregate_exception_1.BaseAggregateException {
|
|
1
|
+
import { BaseAggregateException } from './base.aggregate.exception.js';
|
|
2
|
+
import { BaseException } from './base.exception.js';
|
|
3
|
+
export class AggregateErrorException extends BaseAggregateException {
|
|
7
4
|
constructor(error) {
|
|
8
5
|
const { errors } = error;
|
|
9
6
|
super(errors
|
|
10
7
|
.map(error => {
|
|
11
8
|
if (error instanceof AggregateError) {
|
|
12
|
-
|
|
9
|
+
BaseAggregateException.fromError(error);
|
|
13
10
|
}
|
|
14
11
|
if (error instanceof Error) {
|
|
15
|
-
return
|
|
12
|
+
return BaseException.fromError(error);
|
|
16
13
|
}
|
|
17
14
|
return null;
|
|
18
15
|
})
|
|
@@ -20,5 +17,4 @@ class AggregateErrorException extends base_aggregate_exception_1.BaseAggregateEx
|
|
|
20
17
|
this.stack = error.stack;
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
exports.AggregateErrorException = AggregateErrorException;
|
|
24
20
|
//# sourceMappingURL=aggregate-error.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-error.exception.js","sourceRoot":"","sources":["../../src/exceptions/aggregate-error.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aggregate-error.exception.js","sourceRoot":"","sources":["../../src/exceptions/aggregate-error.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,uBAAwB,SAAQ,sBAAsB;IAClE,YAAmB,KAAqB;QACvC,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAEzB,KAAK,CACJ,MAAM;aACJ,GAAG,CAAC,KAAK,CAAC,EAAE;YACZ,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;gBACrC,sBAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACzC,CAAC;YACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC5B,OAAO,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACvC,CAAC;YAED,OAAO,IAAI,CAAC;QACb,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,SAAS,EAA8B,EAAE,CAAC,SAAS,KAAK,IAAI,CAAC,EACvE,KAAK,CAAC,OAAO,CACb,CAAC;QAED,IAAY,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IACnC,CAAC;CACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseException, ExceptionOptions, JSONBaseException } from './base.exception';
|
|
1
|
+
import { BaseException, ExceptionOptions, JSONBaseException } from './base.exception.js';
|
|
2
2
|
export type JSONBaseAggregateException = Omit<JSONBaseException, 'cause'> & {
|
|
3
3
|
exceptions: JSONBaseException[];
|
|
4
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.aggregate.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/base.aggregate.exception.ts"],"names":[],"mappings":"AACA,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAEjB,MAAM,
|
|
1
|
+
{"version":3,"file":"base.aggregate.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/base.aggregate.exception.ts"],"names":[],"mappings":"AACA,OAAO,EACN,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAEjB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG;IAC3E,UAAU,EAAE,iBAAiB,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAE5E,8BAAsB,sBAAuB,SAAQ,aAAa;IACjE,SAAgB,UAAU,EAAE,aAAa,EAAE,CAAC;IAE5C,SAAS,aACR,UAAU,EAAE,aAAa,EAAE,EAC3B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,6BAA6B;IAOxB,MAAM,IAAI,0BAA0B;WAS7B,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,sBAAsB;cAI5D,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;CAUhE"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const aggregate_error_exception_1 = require("./aggregate-error.exception");
|
|
5
|
-
const base_exception_1 = require("./base.exception");
|
|
6
|
-
class BaseAggregateException extends base_exception_1.BaseException {
|
|
1
|
+
import { AggregateErrorException } from './aggregate-error.exception.js';
|
|
2
|
+
import { BaseException, PAD_COUNT_PER_DEPTH, } from './base.exception.js';
|
|
3
|
+
export class BaseAggregateException extends BaseException {
|
|
7
4
|
exceptions;
|
|
8
5
|
constructor(exceptions, message, options) {
|
|
9
6
|
super(message, options);
|
|
@@ -17,17 +14,16 @@ class BaseAggregateException extends base_exception_1.BaseException {
|
|
|
17
14
|
};
|
|
18
15
|
}
|
|
19
16
|
static fromError(error) {
|
|
20
|
-
return new
|
|
17
|
+
return new AggregateErrorException(error);
|
|
21
18
|
}
|
|
22
19
|
injectBeforeStack(padCount) {
|
|
23
20
|
const innerExceptionsInfo = this.exceptions
|
|
24
21
|
.map(exception => exception['getStringifyFirstLine']())
|
|
25
|
-
.map(line =>
|
|
22
|
+
.map(line => BaseException.padLine(line, padCount));
|
|
26
23
|
return [
|
|
27
|
-
|
|
24
|
+
BaseException.padLine('Aggregated exceptions info:', padCount - PAD_COUNT_PER_DEPTH),
|
|
28
25
|
...innerExceptionsInfo,
|
|
29
26
|
];
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
exports.BaseAggregateException = BaseAggregateException;
|
|
33
29
|
//# sourceMappingURL=base.aggregate.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.aggregate.exception.js","sourceRoot":"","sources":["../../src/exceptions/base.aggregate.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.aggregate.exception.js","sourceRoot":"","sources":["../../src/exceptions/base.aggregate.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EACN,aAAa,EAGb,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAQ7B,MAAM,OAAgB,sBAAuB,SAAQ,aAAa;IACjD,UAAU,CAAkB;IAE5C,YACC,UAA2B,EAC3B,OAAe,EACf,OAAuC;QAEvC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAExB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAEe,MAAM;QACrB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAEhC,OAAO;YACN,GAAG,QAAQ;YACX,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;SAChE,CAAC;IACH,CAAC;IAEM,MAAM,CAAU,SAAS,CAAC,KAAqB;QACrD,OAAO,IAAI,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAEkB,iBAAiB,CAAC,QAAgB;QACpD,MAAM,mBAAmB,GAAG,IAAI,CAAC,UAAU;aACzC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,uBAAuB,CAAC,EAAE,CAAC;aACtD,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;QAErD,OAAO;YACN,aAAa,CAAC,OAAO,CAAC,6BAA6B,EAAE,QAAQ,GAAG,mBAAmB,CAAC;YACpF,GAAG,mBAAmB;SACtB,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/base.exception.ts"],"names":[],"mappings":"AACA,OAAO,EACN,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"base.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/base.exception.ts"],"names":[],"mappings":"AACA,OAAO,EACN,OAAO,EACP,sBAAsB,EACtB,MAAM,MAAM,CAAC;AAKd,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC,8BAAsB,aAAc,SAAQ,KAAK;IAChD,SAAgB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAQ;IAC9C,SAAyB,KAAK,EAAE,MAAM,CAAC;IACvC,SAAyB,OAAO,EAAE,MAAM,CAAC;IACzC,SAAyB,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/C,OAAO,CAAC,UAAU,CAAqC;gBAEpC,OAAO,EAAE,MAAM,EAAE,aAAa,GAAE,gBAAqB;IAexE,IAAoB,IAAI,IAAI,MAAM,CAIjC;IAEM,MAAM,IAAI,iBAAiB;IAmBlB,QAAQ,CAAC,QAAQ,SAAsB,GAAG,MAAM;IAczD,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,sBAAsB,GAAG,MAAM;IAIvF,cAAc,IAAI,OAAO;IAMzB,eAAe,IAAI,OAAO;IAM1B,WAAW,IAAI,OAAO;WAMf,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa;IAIpD,SAAS,CAAC,OAAO,IAAI,QAAQ;IAI7B,SAAS,CAAC,qBAAqB,IAAI,MAAM;IAMzC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAQvD,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIhE,OAAO,CAAC,gBAAgB;CAKxB"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const utils_1 = require("../utils");
|
|
8
|
-
const error_exception_1 = require("./error.exception");
|
|
9
|
-
exports.PAD_COUNT_PER_DEPTH = 4;
|
|
10
|
-
class BaseException extends Error {
|
|
1
|
+
import * as os from 'os';
|
|
2
|
+
import { inspect, } from 'util';
|
|
3
|
+
import { StackTraceFormatter } from '../utils/index.js';
|
|
4
|
+
import { ErrorException } from './error.exception.js';
|
|
5
|
+
export const PAD_COUNT_PER_DEPTH = 4;
|
|
6
|
+
export class BaseException extends Error {
|
|
11
7
|
code = null;
|
|
12
8
|
stack;
|
|
13
9
|
message;
|
|
@@ -35,7 +31,7 @@ class BaseException extends Error {
|
|
|
35
31
|
name,
|
|
36
32
|
code,
|
|
37
33
|
message,
|
|
38
|
-
stack:
|
|
34
|
+
stack: StackTraceFormatter.format(stack, this.name),
|
|
39
35
|
};
|
|
40
36
|
if (cause) {
|
|
41
37
|
this.serialized.cause = cause.toJSON();
|
|
@@ -43,17 +39,17 @@ class BaseException extends Error {
|
|
|
43
39
|
}
|
|
44
40
|
return this.serialized;
|
|
45
41
|
}
|
|
46
|
-
toString(padCount =
|
|
42
|
+
toString(padCount = PAD_COUNT_PER_DEPTH) {
|
|
47
43
|
const { stack } = this.toJSON();
|
|
48
44
|
const formattedStack = stack.map(line => BaseException.padLine(line, padCount));
|
|
49
45
|
const errorLines = [
|
|
50
46
|
this.getStringifyFirstLine(),
|
|
51
|
-
...this.injectBeforeStack(padCount +
|
|
47
|
+
...this.injectBeforeStack(padCount + PAD_COUNT_PER_DEPTH),
|
|
52
48
|
...formattedStack,
|
|
53
49
|
];
|
|
54
50
|
return errorLines.join(os.EOL);
|
|
55
51
|
}
|
|
56
|
-
[
|
|
52
|
+
[inspect.custom](_depth, { stylize }) {
|
|
57
53
|
return stylize(this.toString(), 'regexp');
|
|
58
54
|
}
|
|
59
55
|
isFromNextTick() {
|
|
@@ -69,7 +65,7 @@ class BaseException extends Error {
|
|
|
69
65
|
return lastLine.includes('Timeout._onTimeout');
|
|
70
66
|
}
|
|
71
67
|
static fromError(error) {
|
|
72
|
-
return new
|
|
68
|
+
return new ErrorException(error);
|
|
73
69
|
}
|
|
74
70
|
getCtor() {
|
|
75
71
|
return Object.getPrototypeOf(this).constructor;
|
|
@@ -92,5 +88,4 @@ class BaseException extends Error {
|
|
|
92
88
|
return stack[stack.length - 1] ?? '';
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
|
-
exports.BaseException = BaseException;
|
|
96
91
|
//# sourceMappingURL=base.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.exception.js","sourceRoot":"","sources":["../../src/exceptions/base.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.exception.js","sourceRoot":"","sources":["../../src/exceptions/base.exception.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EACN,OAAO,GAEP,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAetD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC,MAAM,OAAgB,aAAc,SAAQ,KAA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EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAE9C,OAAO,GAAG,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;IACxE,CAAC;IAES,iBAAiB,CAAC,QAAgB;QAC3C,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC9E,CAAC;QAED,OAAO,EAAE,CAAC;IACX,CAAC;IAES,MAAM,CAAC,OAAO,CAAC,IAAY,EAAE,QAAgB;QACtD,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC;IACzC,CAAC;IAEO,gBAAgB;QACvB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAEhC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/error.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"error.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/error.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,cAAe,SAAQ,aAAa;gBAC7B,KAAK,EAAE,KAAK;CAY/B"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ErrorException = void 0;
|
|
4
|
-
const base_exception_1 = require("./base.exception");
|
|
5
|
-
class ErrorException extends base_exception_1.BaseException {
|
|
1
|
+
import { BaseException } from './base.exception.js';
|
|
2
|
+
export class ErrorException extends BaseException {
|
|
6
3
|
constructor(error) {
|
|
7
4
|
const { cause } = error;
|
|
8
5
|
super(error.message, {
|
|
@@ -13,5 +10,4 @@ class ErrorException extends base_exception_1.BaseException {
|
|
|
13
10
|
this.stack = error.stack;
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
exports.ErrorException = ErrorException;
|
|
17
13
|
//# sourceMappingURL=error.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.exception.js","sourceRoot":"","sources":["../../src/exceptions/error.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error.exception.js","sourceRoot":"","sources":["../../src/exceptions/error.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,cAAe,SAAQ,aAAa;IAChD,YAAmB,KAAY;QAC9B,MAAM,EAAE,KAAK,EAAE,GAAG,KAAY,CAAC;QAE/B,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE;YACpB,KAAK,EAAE,KAAK,YAAY,KAAK;gBAC5B,CAAC,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC;gBAE3B,CAAC,CAAC,SAAS;SACZ,CAAC,CAAC;QAEF,IAAY,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IACnC,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/forbidden.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"forbidden.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/forbidden.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,kBAAmB,SAAQ,aAAa;CAAG"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ForbiddenException = void 0;
|
|
4
|
-
const base_exception_1 = require("./base.exception");
|
|
5
|
-
class ForbiddenException extends base_exception_1.BaseException {
|
|
1
|
+
import { BaseException } from './base.exception.js';
|
|
2
|
+
export class ForbiddenException extends BaseException {
|
|
6
3
|
}
|
|
7
|
-
exports.ForbiddenException = ForbiddenException;
|
|
8
4
|
//# sourceMappingURL=forbidden.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden.exception.js","sourceRoot":"","sources":["../../src/exceptions/forbidden.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forbidden.exception.js","sourceRoot":"","sources":["../../src/exceptions/forbidden.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,kBAAmB,SAAQ,aAAa;CAAG"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from './error.exception';
|
|
2
|
-
export * from './aggregate-error.exception';
|
|
3
|
-
export * from './base.exception';
|
|
4
|
-
export * from './base.aggregate.exception';
|
|
5
|
-
export * from './unknown.exception';
|
|
6
|
-
export * from './not-implemented.exception';
|
|
7
|
-
export * from './will-never-happened.exception';
|
|
8
|
-
export * from './forbidden.exception';
|
|
9
|
-
export * from './invalid-input.exception';
|
|
1
|
+
export * from './error.exception.js';
|
|
2
|
+
export * from './aggregate-error.exception.js';
|
|
3
|
+
export * from './base.exception.js';
|
|
4
|
+
export * from './base.aggregate.exception.js';
|
|
5
|
+
export * from './unknown.exception.js';
|
|
6
|
+
export * from './not-implemented.exception.js';
|
|
7
|
+
export * from './will-never-happened.exception.js';
|
|
8
|
+
export * from './forbidden.exception.js';
|
|
9
|
+
export * from './invalid-input.exception.js';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AACA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAE/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC"}
|
package/dist/exceptions/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
tslib_1.__exportStar(require("./will-never-happened.exception"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./forbidden.exception"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./invalid-input.exception"), exports);
|
|
1
|
+
export * from './error.exception.js';
|
|
2
|
+
export * from './aggregate-error.exception.js';
|
|
3
|
+
export * from './base.exception.js';
|
|
4
|
+
export * from './base.aggregate.exception.js';
|
|
5
|
+
export * from './unknown.exception.js';
|
|
6
|
+
export * from './not-implemented.exception.js';
|
|
7
|
+
export * from './will-never-happened.exception.js';
|
|
8
|
+
export * from './forbidden.exception.js';
|
|
9
|
+
export * from './invalid-input.exception.js';
|
|
13
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAE/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-input.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/invalid-input.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"invalid-input.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/invalid-input.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,qBAAsB,SAAQ,aAAa;CAAG"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.InvalidInputException = void 0;
|
|
4
|
-
const base_exception_1 = require("./base.exception");
|
|
5
|
-
class InvalidInputException extends base_exception_1.BaseException {
|
|
1
|
+
import { BaseException } from './base.exception.js';
|
|
2
|
+
export class InvalidInputException extends BaseException {
|
|
6
3
|
}
|
|
7
|
-
exports.InvalidInputException = InvalidInputException;
|
|
8
4
|
//# sourceMappingURL=invalid-input.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invalid-input.exception.js","sourceRoot":"","sources":["../../src/exceptions/invalid-input.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invalid-input.exception.js","sourceRoot":"","sources":["../../src/exceptions/invalid-input.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,qBAAsB,SAAQ,aAAa;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not-implemented.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/not-implemented.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"not-implemented.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/not-implemented.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,uBAAwB,SAAQ,aAAa;;CAIzD"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.NotImplementedException = void 0;
|
|
4
|
-
const base_exception_1 = require("./base.exception");
|
|
5
|
-
class NotImplementedException extends base_exception_1.BaseException {
|
|
1
|
+
import { BaseException } from './base.exception.js';
|
|
2
|
+
export class NotImplementedException extends BaseException {
|
|
6
3
|
constructor() {
|
|
7
4
|
super('Not implemented');
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.NotImplementedException = NotImplementedException;
|
|
11
7
|
//# sourceMappingURL=not-implemented.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not-implemented.exception.js","sourceRoot":"","sources":["../../src/exceptions/not-implemented.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"not-implemented.exception.js","sourceRoot":"","sources":["../../src/exceptions/not-implemented.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,uBAAwB,SAAQ,aAAa;IACzD;QACC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1B,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/unknown.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"unknown.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/unknown.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,gBAAiB,SAAQ,aAAa;gBAC/B,OAAO,EAAE,MAAM;CAGlC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.UnknownException = void 0;
|
|
4
|
-
const base_exception_1 = require("./base.exception");
|
|
5
|
-
class UnknownException extends base_exception_1.BaseException {
|
|
1
|
+
import { BaseException } from './base.exception.js';
|
|
2
|
+
export class UnknownException extends BaseException {
|
|
6
3
|
constructor(message) {
|
|
7
4
|
super(message);
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.UnknownException = UnknownException;
|
|
11
7
|
//# sourceMappingURL=unknown.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unknown.exception.js","sourceRoot":"","sources":["../../src/exceptions/unknown.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unknown.exception.js","sourceRoot":"","sources":["../../src/exceptions/unknown.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,gBAAiB,SAAQ,aAAa;IAClD,YAAmB,OAAe;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChB,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"will-never-happened.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/will-never-happened.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"will-never-happened.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/will-never-happened.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,qBAAa,0BAA2B,SAAQ,aAAa;gBACzC,OAAO,EAAE,MAAM;CAGlC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.WillNeverHappenedException = void 0;
|
|
4
|
-
const base_exception_1 = require("./base.exception");
|
|
5
|
-
class WillNeverHappenedException extends base_exception_1.BaseException {
|
|
1
|
+
import { BaseException } from './base.exception.js';
|
|
2
|
+
export class WillNeverHappenedException extends BaseException {
|
|
6
3
|
constructor(message) {
|
|
7
4
|
super(message);
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.WillNeverHappenedException = WillNeverHappenedException;
|
|
11
7
|
//# sourceMappingURL=will-never-happened.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"will-never-happened.exception.js","sourceRoot":"","sources":["../../src/exceptions/will-never-happened.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"will-never-happened.exception.js","sourceRoot":"","sources":["../../src/exceptions/will-never-happened.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,0BAA2B,SAAQ,aAAa;IAC5D,YAAmB,OAAe;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChB,CAAC;CACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './exceptions';
|
|
2
|
-
export * from './exception.factory';
|
|
1
|
+
export * from './exceptions/index.js';
|
|
2
|
+
export * from './exception.factory.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./exceptions"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./exception.factory"), exports);
|
|
1
|
+
export * from './exceptions/index.js';
|
|
2
|
+
export * from './exception.factory.js';
|
|
6
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,57 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const test_aggregate_exception_1 = require("./test.aggregate-exception");
|
|
8
|
-
const test_exception_1 = require("./test.exception");
|
|
9
|
-
let SerializationTestSuite = class SerializationTestSuite extends tests_1.Suite {
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Describe, expect, Suite, Test, } from '@hg-ts/tests';
|
|
3
|
+
import { BaseAggregateException, BaseException, ErrorException, } from '../exceptions/index.js';
|
|
4
|
+
import { TestAggregateException } from './test.aggregate-exception.js';
|
|
5
|
+
import { TestException } from './test.exception.js';
|
|
6
|
+
let SerializationTestSuite = class SerializationTestSuite extends Suite {
|
|
10
7
|
async commonTest() {
|
|
11
8
|
const message = 'Test message';
|
|
12
|
-
const exception = new
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
const exception = new TestException(message);
|
|
10
|
+
expect(exception).toBeInstanceOf(Error);
|
|
11
|
+
expect(exception).toBeInstanceOf(BaseException);
|
|
12
|
+
expect(exception).toBeInstanceOf(TestException);
|
|
13
|
+
expect(exception.message).toEqual(message);
|
|
14
|
+
expect(exception.code).toBeNull();
|
|
15
|
+
expect(exception.toJSON().name).toEqual(TestException.name);
|
|
16
|
+
expect(exception.toJSON().stack).toBeInstanceOf(Array);
|
|
17
|
+
expect(exception.toJSON().stack).not.toEqual([]);
|
|
21
18
|
}
|
|
22
19
|
async baseExceptionFromError() {
|
|
23
20
|
const message = 'Test message';
|
|
24
21
|
const error = new Error(message);
|
|
25
|
-
const exception =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
const exception = BaseException.fromError(error);
|
|
23
|
+
expect(exception).toBeInstanceOf(Error);
|
|
24
|
+
expect(exception).toBeInstanceOf(BaseException);
|
|
25
|
+
expect(exception).toBeInstanceOf(ErrorException);
|
|
26
|
+
expect(exception.message).toEqual(message);
|
|
27
|
+
expect(exception.code).toBeNull();
|
|
28
|
+
expect(exception.toJSON().stack).toBeInstanceOf(Array);
|
|
29
|
+
expect(exception.toJSON().stack).not.toEqual([]);
|
|
33
30
|
}
|
|
34
31
|
async aggregateExceptionTest() {
|
|
35
32
|
const message = 'Test aggregate message';
|
|
36
|
-
const exception = new
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const exception = new TestAggregateException(message);
|
|
34
|
+
expect(exception).toBeInstanceOf(Error);
|
|
35
|
+
expect(exception).toBeInstanceOf(BaseException);
|
|
36
|
+
expect(exception).toBeInstanceOf(BaseAggregateException);
|
|
37
|
+
expect(exception).toBeInstanceOf(TestAggregateException);
|
|
38
|
+
expect(exception.message).toEqual(message);
|
|
39
|
+
expect(exception.code).toBeNull();
|
|
40
|
+
expect(exception.exceptions).toBeInstanceOf(Array);
|
|
41
|
+
expect(exception.exceptions).toHaveLength(3);
|
|
45
42
|
}
|
|
46
43
|
async syncStackTest() {
|
|
47
|
-
const { stack } = new
|
|
48
|
-
|
|
44
|
+
const { stack } = new TestException('Test message').toJSON();
|
|
45
|
+
expect(stack[0].startsWith(`at ${this.constructor.name}.syncStackTest`)).toBeTruthy();
|
|
49
46
|
}
|
|
50
47
|
async isFromNextTickTest() {
|
|
51
48
|
return new Promise(resolve => {
|
|
52
49
|
process.nextTick(() => {
|
|
53
|
-
const exception = new
|
|
54
|
-
|
|
50
|
+
const exception = new TestException('Test message');
|
|
51
|
+
expect(exception.isFromNextTick()).toBeTruthy();
|
|
55
52
|
resolve();
|
|
56
53
|
});
|
|
57
54
|
});
|
|
@@ -59,8 +56,8 @@ let SerializationTestSuite = class SerializationTestSuite extends tests_1.Suite
|
|
|
59
56
|
async isFromImmediateTest() {
|
|
60
57
|
return new Promise(resolve => {
|
|
61
58
|
setImmediate(() => {
|
|
62
|
-
const exception = new
|
|
63
|
-
|
|
59
|
+
const exception = new TestException('Test message');
|
|
60
|
+
expect(exception.isFromImmediate()).toBeTruthy();
|
|
64
61
|
resolve();
|
|
65
62
|
});
|
|
66
63
|
});
|
|
@@ -68,8 +65,8 @@ let SerializationTestSuite = class SerializationTestSuite extends tests_1.Suite
|
|
|
68
65
|
async fromTimeoutTest() {
|
|
69
66
|
return new Promise(resolve => {
|
|
70
67
|
setTimeout(() => {
|
|
71
|
-
const exception = new
|
|
72
|
-
|
|
68
|
+
const exception = new TestException('Test message');
|
|
69
|
+
expect(exception.isFromTimer()).toBeTruthy();
|
|
73
70
|
resolve();
|
|
74
71
|
}, 0);
|
|
75
72
|
});
|
|
@@ -78,64 +75,64 @@ let SerializationTestSuite = class SerializationTestSuite extends tests_1.Suite
|
|
|
78
75
|
let interval;
|
|
79
76
|
return new Promise(resolve => {
|
|
80
77
|
interval = setInterval(() => {
|
|
81
|
-
const exception = new
|
|
82
|
-
|
|
78
|
+
const exception = new TestException('Test message');
|
|
79
|
+
expect(exception.isFromTimer()).toBeTruthy();
|
|
83
80
|
clearInterval(interval);
|
|
84
81
|
resolve();
|
|
85
82
|
}, 0);
|
|
86
83
|
});
|
|
87
84
|
}
|
|
88
85
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
86
|
+
__decorate([
|
|
87
|
+
Test(),
|
|
88
|
+
__metadata("design:type", Function),
|
|
89
|
+
__metadata("design:paramtypes", []),
|
|
90
|
+
__metadata("design:returntype", Promise)
|
|
95
91
|
], SerializationTestSuite.prototype, "commonTest", null);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
__decorate([
|
|
93
|
+
Test(),
|
|
94
|
+
__metadata("design:type", Function),
|
|
95
|
+
__metadata("design:paramtypes", []),
|
|
96
|
+
__metadata("design:returntype", Promise)
|
|
101
97
|
], SerializationTestSuite.prototype, "baseExceptionFromError", null);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
__decorate([
|
|
99
|
+
Test(),
|
|
100
|
+
__metadata("design:type", Function),
|
|
101
|
+
__metadata("design:paramtypes", []),
|
|
102
|
+
__metadata("design:returntype", Promise)
|
|
107
103
|
], SerializationTestSuite.prototype, "aggregateExceptionTest", null);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
__decorate([
|
|
105
|
+
Test(),
|
|
106
|
+
__metadata("design:type", Function),
|
|
107
|
+
__metadata("design:paramtypes", []),
|
|
108
|
+
__metadata("design:returntype", Promise)
|
|
113
109
|
], SerializationTestSuite.prototype, "syncStackTest", null);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
__decorate([
|
|
111
|
+
Test(),
|
|
112
|
+
__metadata("design:type", Function),
|
|
113
|
+
__metadata("design:paramtypes", []),
|
|
114
|
+
__metadata("design:returntype", Promise)
|
|
119
115
|
], SerializationTestSuite.prototype, "isFromNextTickTest", null);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
__decorate([
|
|
117
|
+
Test(),
|
|
118
|
+
__metadata("design:type", Function),
|
|
119
|
+
__metadata("design:paramtypes", []),
|
|
120
|
+
__metadata("design:returntype", Promise)
|
|
125
121
|
], SerializationTestSuite.prototype, "isFromImmediateTest", null);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
__decorate([
|
|
123
|
+
Test(),
|
|
124
|
+
__metadata("design:type", Function),
|
|
125
|
+
__metadata("design:paramtypes", []),
|
|
126
|
+
__metadata("design:returntype", Promise)
|
|
131
127
|
], SerializationTestSuite.prototype, "fromTimeoutTest", null);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
__decorate([
|
|
129
|
+
Test(),
|
|
130
|
+
__metadata("design:type", Function),
|
|
131
|
+
__metadata("design:paramtypes", []),
|
|
132
|
+
__metadata("design:returntype", Promise)
|
|
137
133
|
], SerializationTestSuite.prototype, "fromIntervalTest", null);
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
SerializationTestSuite = __decorate([
|
|
135
|
+
Describe()
|
|
140
136
|
], SerializationTestSuite);
|
|
137
|
+
export { SerializationTestSuite };
|
|
141
138
|
//# sourceMappingURL=serialization.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.test.js","sourceRoot":"","sources":["../../src/tests/serialization.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialization.test.js","sourceRoot":"","sources":["../../src/tests/serialization.test.ts"],"names":[],"mappings":";AAAA,OAAO,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,IAAI,G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W,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC;gBAC7C,OAAO,EAAE,CAAC;YACX,CAAC,EAAE,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACJ,CAAC;IAGY,AAAN,KAAK,CAAC,gBAAgB;QAC5B,IAAI,QAAwB,CAAC;QAC7B,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAClC,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;gBAC3B,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;gBAEpD,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC;gBAC7C,aAAa,CAAC,QAAQ,CAAC,CAAC;gBACxB,OAAO,EAAE,CAAC;YACX,CAAC,EAAE,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AAtGa;IADZ,IAAI,EAAE;;;;wDAaN;AAGY;IADZ,IAAI,EAAE;;;;oEAaN;AAGY;IADZ,IAAI,EAAE;;;;oEAeN;AAGY;IADZ,IAAI,EAAE;;;;2DAKN;AAGY;IADZ,IAAI,EAAE;;;;gEAUN;AAGY;IADZ,IAAI,EAAE;;;;iEAUN;AAGY;IADZ,IAAI,EAAE;;;;6DAUN;AAGY;IADZ,IAAI,EAAE;;;;8DAYN;AAvGW,sBAAsB;IADlC,QAAQ,EAAE;GACE,sBAAsB,CAwGlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.aggregate-exception.d.ts","sourceRoot":"","sources":["../../src/tests/test.aggregate-exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"test.aggregate-exception.d.ts","sourceRoot":"","sources":["../../src/tests/test.aggregate-exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,qBAAa,sBAAuB,SAAQ,sBAAsB;gBAC9C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAWjD"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const exceptions_1 = require("../exceptions");
|
|
5
|
-
const test_exception_1 = require("./test.exception");
|
|
6
|
-
class TestAggregateException extends exceptions_1.BaseAggregateException {
|
|
1
|
+
import { BaseAggregateException } from '../exceptions/index.js';
|
|
2
|
+
import { TestException } from './test.exception.js';
|
|
3
|
+
export class TestAggregateException extends BaseAggregateException {
|
|
7
4
|
constructor(message, code) {
|
|
8
5
|
super([
|
|
9
|
-
new
|
|
10
|
-
new
|
|
11
|
-
new
|
|
6
|
+
new TestException('First inner exception'),
|
|
7
|
+
new TestException('Second inner exception'),
|
|
8
|
+
new TestException('Third inner exception'),
|
|
12
9
|
], message, { code });
|
|
13
10
|
}
|
|
14
11
|
}
|
|
15
|
-
exports.TestAggregateException = TestAggregateException;
|
|
16
12
|
//# sourceMappingURL=test.aggregate-exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.aggregate-exception.js","sourceRoot":"","sources":["../../src/tests/test.aggregate-exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.aggregate-exception.js","sourceRoot":"","sources":["../../src/tests/test.aggregate-exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,OAAO,sBAAuB,SAAQ,sBAAsB;IACjE,YAAmB,OAAe,EAAE,IAAa;QAChD,KAAK,CACJ;YACC,IAAI,aAAa,CAAC,uBAAuB,CAAC;YAC1C,IAAI,aAAa,CAAC,wBAAwB,CAAC;YAC3C,IAAI,aAAa,CAAC,uBAAuB,CAAC;SAC1C,EACD,OAAO,EACP,EAAE,IAAI,EAAE,CACR,CAAC;IACH,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.exception.d.ts","sourceRoot":"","sources":["../../src/tests/test.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"test.exception.d.ts","sourceRoot":"","sources":["../../src/tests/test.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,qBAAa,aAAc,SAAQ,aAAa;gBAC5B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAGjD"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.TestException = void 0;
|
|
4
|
-
const exceptions_1 = require("../exceptions");
|
|
5
|
-
class TestException extends exceptions_1.BaseException {
|
|
1
|
+
import { BaseException } from '../exceptions/index.js';
|
|
2
|
+
export class TestException extends BaseException {
|
|
6
3
|
constructor(message, code) {
|
|
7
4
|
super(message, { code });
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.TestException = TestException;
|
|
11
7
|
//# sourceMappingURL=test.exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.exception.js","sourceRoot":"","sources":["../../src/tests/test.exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.exception.js","sourceRoot":"","sources":["../../src/tests/test.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,OAAO,aAAc,SAAQ,aAAa;IAC/C,YAAmB,OAAe,EAAE,IAAa;QAChD,KAAK,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1B,CAAC;CACD"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './stack-trace.formatter';
|
|
1
|
+
export * from './stack-trace.formatter.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
package/dist/utils/index.js
CHANGED
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const os_1 = tslib_1.__importDefault(require("os"));
|
|
6
|
-
const consts_1 = require("../consts");
|
|
7
|
-
class StackTraceFormatter {
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import { SOURCE_MAP_ENABLED } from '../consts.js';
|
|
3
|
+
export class StackTraceFormatter {
|
|
8
4
|
static format(stack, exceptionName) {
|
|
9
5
|
return StackTraceFormatter.getStackLines(stack, exceptionName);
|
|
10
6
|
}
|
|
11
7
|
static getStackLines(stack, exceptionName) {
|
|
12
|
-
let lines = stack.split(
|
|
8
|
+
let lines = stack.split(os.EOL)
|
|
13
9
|
.splice(1)
|
|
14
10
|
.filter(stackLine => !StackTraceFormatter.isInternalStackLine(stackLine))
|
|
15
11
|
.map(line => line.trim());
|
|
16
|
-
if (
|
|
12
|
+
if (SOURCE_MAP_ENABLED) {
|
|
17
13
|
lines = lines.slice(4);
|
|
18
14
|
}
|
|
19
15
|
const lineFromExceptionConstructor = lines.findIndex(line => line.startsWith(`at new ${exceptionName}`));
|
|
@@ -26,5 +22,4 @@ class StackTraceFormatter {
|
|
|
26
22
|
return line.includes('internal/') && !line.includes('processTicksAndRejections');
|
|
27
23
|
}
|
|
28
24
|
}
|
|
29
|
-
exports.StackTraceFormatter = StackTraceFormatter;
|
|
30
25
|
//# sourceMappingURL=stack-trace.formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-trace.formatter.js","sourceRoot":"","sources":["../../src/utils/stack-trace.formatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stack-trace.formatter.js","sourceRoot":"","sources":["../../src/utils/stack-trace.formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,OAAO,mBAAmB;IACxB,MAAM,CAAC,MAAM,CAAC,KAAa,EAAE,aAAqB;QACxD,OAAO,mBAAmB,CAAC,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAChE,CAAC;IAES,MAAM,CAAC,aAAa,CAAC,KAAa,EAAE,aAAqB;QAClE,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC;aAC7B,MAAM,CAAC,CAAC,CAAC;aACT,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;aACxE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE3B,IAAI,kBAAkB,EAAE,CAAC;YACxB,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;QACD,MAAM,4BAA4B,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,aAAa,EAAE,CAAC,CAAC,CAAC;QAEzG,IAAI,4BAA4B,GAAG,CAAC,CAAC,EAAE,CAAC;YACvC,OAAO,KAAK,CAAC,KAAK,CAAC,4BAA4B,GAAG,CAAC,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;IAES,MAAM,CAAC,mBAAmB,CAAC,IAAY;QAChD,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC;IAClF,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hg-ts/exception",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"exports": {
|
|
6
7
|
".": "./dist/index.js"
|
|
7
8
|
},
|
|
@@ -17,10 +18,10 @@
|
|
|
17
18
|
"test:dev": "HG_ENV=test vitest watch"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"@hg-ts-config/typescript": "0.
|
|
21
|
-
"@hg-ts/linter": "0.
|
|
22
|
-
"@hg-ts/tests": "0.
|
|
23
|
-
"@hg-ts/types": "0.
|
|
21
|
+
"@hg-ts-config/typescript": "0.4.0",
|
|
22
|
+
"@hg-ts/linter": "0.4.0",
|
|
23
|
+
"@hg-ts/tests": "0.4.0",
|
|
24
|
+
"@hg-ts/types": "0.4.0",
|
|
24
25
|
"@types/node": "22.19.1",
|
|
25
26
|
"@vitest/coverage-v8": "4.0.14",
|
|
26
27
|
"eslint": "9.18.0",
|
package/tsconfig.json
CHANGED