mnemonica 0.9.945 → 0.9.948
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/build/api/errors/bindedMethodErrorHandler.js +50 -50
- package/build/api/errors/exceptionConstructor.js +98 -98
- package/build/api/errors/index.js +45 -45
- package/build/api/errors/throwModificationError.js +94 -94
- package/build/api/hooks/flowCheckers.js +9 -9
- package/build/api/hooks/index.js +7 -7
- package/build/api/hooks/invokeHook.js +44 -44
- package/build/api/hooks/registerHook.js +17 -17
- package/build/api/index.js +9 -9
- package/build/api/types/InstanceCreator.js +237 -237
- package/build/api/types/InstanceModificator.js +8 -8
- package/build/api/types/Mnemosyne.js +127 -127
- package/build/api/types/TypeProxy.js +132 -132
- package/build/api/types/addProps.js +60 -60
- package/build/api/types/compileNewModificatorFunctionBody.js +33 -33
- package/build/api/types/createInstanceModificator.js +27 -27
- package/build/api/types/createInstanceModificator200XthWay.js +30 -30
- package/build/api/types/index.js +157 -157
- package/build/api/types/obeyConstructor.js +23 -23
- package/build/api/utils/index.js +122 -122
- package/build/constants/index.js +61 -61
- package/build/descriptors/errors/index.js +7 -7
- package/build/descriptors/index.js +5 -5
- package/build/descriptors/namespaces/index.js +70 -70
- package/build/descriptors/types/index.js +140 -140
- package/build/index.js +26 -26
- package/build/types/index.js +1 -1
- package/build/utils/collectConstructors.js +50 -50
- package/build/utils/defineStackCleaner.js +7 -7
- package/build/utils/extract.js +14 -14
- package/build/utils/hop.js +1 -1
- package/build/utils/index.js +27 -27
- package/build/utils/merge.js +13 -13
- package/build/utils/parent.js +15 -15
- package/build/utils/parse.js +40 -40
- package/build/utils/pick.js +19 -19
- package/build/utils/toJSON.js +25 -25
- package/package.json +32 -32
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bindedMethodErrorHandler = void 0;
|
|
4
|
-
const constants_1 = require(
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
5
|
const { odp, } = constants_1.constants;
|
|
6
6
|
const bindedMethodErrorHandler = (exceptionReason) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
7
|
+
const { applyTo, args, method, asNew, error } = exceptionReason;
|
|
8
|
+
const reThrown = error.exceptionReason !== undefined;
|
|
9
|
+
if (reThrown) {
|
|
10
|
+
error.reasons.push(exceptionReason);
|
|
11
|
+
error.surplus.push(error);
|
|
12
|
+
return error;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
odp(error, 'exceptionReason', {
|
|
16
|
+
get() {
|
|
17
|
+
return exceptionReason;
|
|
18
|
+
},
|
|
19
|
+
enumerable: true
|
|
20
|
+
});
|
|
21
|
+
const reasons = [exceptionReason];
|
|
22
|
+
odp(error, 'reasons', {
|
|
23
|
+
get() {
|
|
24
|
+
return reasons;
|
|
25
|
+
},
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
28
|
+
const surplus = [];
|
|
29
|
+
odp(error, 'surplus', {
|
|
30
|
+
get() {
|
|
31
|
+
return surplus;
|
|
32
|
+
},
|
|
33
|
+
enumerable: true
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (applyTo && applyTo.exception instanceof Function) {
|
|
37
|
+
let preparedException = error;
|
|
38
|
+
try {
|
|
39
|
+
preparedException = new applyTo.exception(error, {
|
|
40
|
+
args,
|
|
41
|
+
exceptionReasonMethod: method,
|
|
42
|
+
exceptionReasonObject: applyTo,
|
|
43
|
+
reasonsIsNew: asNew
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
catch (additionalError) {
|
|
47
|
+
error.surplus.push(additionalError);
|
|
48
|
+
return error;
|
|
49
|
+
}
|
|
50
|
+
if (preparedException instanceof Error) {
|
|
51
|
+
return preparedException;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return error;
|
|
55
55
|
};
|
|
56
56
|
exports.bindedMethodErrorHandler = bindedMethodErrorHandler;
|
|
@@ -1,110 +1,110 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const constants_1 = require(
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../../constants");
|
|
4
4
|
const { odp } = constants_1.constants;
|
|
5
|
-
const errors_1 = require(
|
|
5
|
+
const errors_1 = require("../../descriptors/errors");
|
|
6
6
|
const { WRONG_ARGUMENTS_USED, WRONG_INSTANCE_INVOCATION } = errors_1.ErrorsTypes;
|
|
7
|
-
const errors_2 = require(
|
|
8
|
-
const utils_1 = require(
|
|
7
|
+
const errors_2 = require("../errors");
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
9
|
const { parse } = utils_1.utils;
|
|
10
|
-
const utils_2 = require(
|
|
10
|
+
const utils_2 = require("../utils");
|
|
11
11
|
const { makeFakeModificatorType } = utils_2.default;
|
|
12
|
-
const InstanceModificator_1 = require(
|
|
12
|
+
const InstanceModificator_1 = require("../types/InstanceModificator");
|
|
13
13
|
const checkThrowArgs = (instance, target, error, args) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
14
|
+
let wrongThrow;
|
|
15
|
+
if (!target) {
|
|
16
|
+
throw new WRONG_INSTANCE_INVOCATION('exception should be made with new keyword');
|
|
17
|
+
}
|
|
18
|
+
if (!(error instanceof Error)) {
|
|
19
|
+
wrongThrow = new WRONG_ARGUMENTS_USED('error must be instanceof Error');
|
|
20
|
+
}
|
|
21
|
+
if (!(wrongThrow instanceof Error)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
odp(wrongThrow, 'instance', {
|
|
25
|
+
get() {
|
|
26
|
+
return instance;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
odp(wrongThrow, 'error', {
|
|
30
|
+
get() {
|
|
31
|
+
return error;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
odp(wrongThrow, 'args', {
|
|
35
|
+
get() {
|
|
36
|
+
return args;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
throw wrongThrow;
|
|
40
40
|
};
|
|
41
41
|
const exceptionConsctructHandler = function (opts) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
42
|
+
const { instance, TypeName, typeStack, args, error } = opts;
|
|
43
|
+
const exception = this;
|
|
44
|
+
odp(exception, 'args', {
|
|
45
|
+
get() {
|
|
46
|
+
return args;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
odp(exception, 'originalError', {
|
|
50
|
+
get() {
|
|
51
|
+
return error;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
odp(exception, 'instance', {
|
|
55
|
+
get() {
|
|
56
|
+
return instance;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
odp(exception, 'extract', {
|
|
60
|
+
get() {
|
|
61
|
+
return () => {
|
|
62
|
+
return instance.extract();
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
odp(exception, 'parse', {
|
|
67
|
+
get() {
|
|
68
|
+
return () => {
|
|
69
|
+
return parse(instance);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const errorStack = exception.stack.split('\n');
|
|
74
|
+
const stack = [];
|
|
75
|
+
const title = `\n<-- lifecycle of [ ${TypeName} ] traced -->`;
|
|
76
|
+
errors_2.getStack.call(exception, title, [], prepareException);
|
|
77
|
+
stack.push(...exception.stack);
|
|
78
|
+
stack.push('<-- with the following error -->');
|
|
79
|
+
errorStack.forEach((line) => {
|
|
80
|
+
if (!stack.includes(line)) {
|
|
81
|
+
stack.push(line);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
stack.push('\n<-- of constructor definitions stack -->');
|
|
85
|
+
stack.push(...typeStack);
|
|
86
|
+
exception.stack = (0, errors_2.cleanupStack)(stack).join('\n');
|
|
87
|
+
return exception;
|
|
88
88
|
};
|
|
89
89
|
const prepareException = function (target, error, ...args) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
90
|
+
const instance = this;
|
|
91
|
+
checkThrowArgs(instance, target, error, args);
|
|
92
|
+
const { __type__, __creator__ } = instance;
|
|
93
|
+
const { stack: typeStack, TypeName } = __type__;
|
|
94
|
+
const ExceptionCreator = Object.create(__creator__);
|
|
95
|
+
ExceptionCreator.config = Object.assign({}, __creator__.config);
|
|
96
|
+
ExceptionCreator.config.blockErrors = false;
|
|
97
|
+
ExceptionCreator.existentInstance = error;
|
|
98
|
+
ExceptionCreator.ModificatorType = makeFakeModificatorType(TypeName, function () {
|
|
99
|
+
return exceptionConsctructHandler.call(this, {
|
|
100
|
+
instance,
|
|
101
|
+
TypeName,
|
|
102
|
+
typeStack,
|
|
103
|
+
args,
|
|
104
|
+
error
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
ExceptionCreator.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(ExceptionCreator);
|
|
108
|
+
return new ExceptionCreator.InstanceModificator();
|
|
109
109
|
};
|
|
110
110
|
exports.default = prepareException;
|
|
@@ -1,61 +1,61 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.constructError = exports.BASE_MNEMONICA_ERROR = exports.getStack = exports.cleanupStack = exports.stackCleaners = void 0;
|
|
4
|
-
const constants_1 = require(
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
5
|
const { odp, SymbolConstructorName, MNEMONICA, ErrorMessages, } = constants_1.constants;
|
|
6
6
|
const { BASE_ERROR_MESSAGE } = ErrorMessages;
|
|
7
7
|
exports.stackCleaners = [];
|
|
8
8
|
const cleanupStack = (stack) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const cleaned = stack.reduce((arr, line) => {
|
|
10
|
+
exports.stackCleaners.forEach(cleanerRegExp => {
|
|
11
|
+
if (!cleanerRegExp.test(line)) {
|
|
12
|
+
arr.push(line);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return arr;
|
|
16
|
+
}, []);
|
|
17
|
+
return cleaned.length ? cleaned : stack;
|
|
18
18
|
};
|
|
19
19
|
exports.cleanupStack = cleanupStack;
|
|
20
20
|
const getStack = function (title, stackAddition, tillFunction) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
if (Error.captureStackTrace) {
|
|
22
|
+
Error.captureStackTrace(this, tillFunction || exports.getStack);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.stack = (new Error()).stack;
|
|
26
|
+
}
|
|
27
|
+
this.stack = this.stack.split('\n').slice(1);
|
|
28
|
+
this.stack = (0, exports.cleanupStack)(this.stack);
|
|
29
|
+
this.stack.unshift(title);
|
|
30
|
+
if (Array.isArray(stackAddition) && stackAddition.length) {
|
|
31
|
+
this.stack.push(...stackAddition);
|
|
32
|
+
}
|
|
33
|
+
this.stack.push('\n');
|
|
34
|
+
return this.stack;
|
|
35
35
|
};
|
|
36
36
|
exports.getStack = getStack;
|
|
37
37
|
class BASE_MNEMONICA_ERROR extends Error {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
constructor(message = BASE_ERROR_MESSAGE, additionalStack) {
|
|
39
|
+
super(message);
|
|
40
|
+
const BaseStack = this.stack;
|
|
41
|
+
odp(this, 'BaseStack', {
|
|
42
|
+
get() {
|
|
43
|
+
return BaseStack;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const stack = (0, exports.cleanupStack)(BaseStack.split('\n'));
|
|
47
|
+
if (additionalStack) {
|
|
48
|
+
stack.unshift(...additionalStack);
|
|
49
|
+
}
|
|
50
|
+
this.stack = stack.join('\n');
|
|
51
|
+
}
|
|
52
|
+
static get [SymbolConstructorName]() {
|
|
53
|
+
return `base of : ${MNEMONICA} : errors`;
|
|
54
|
+
}
|
|
55
55
|
}
|
|
56
56
|
exports.BASE_MNEMONICA_ERROR = BASE_MNEMONICA_ERROR;
|
|
57
57
|
const constructError = (name, message) => {
|
|
58
|
-
|
|
58
|
+
const body = `
|
|
59
59
|
class ${name} extends base {
|
|
60
60
|
constructor (addition, stack) {
|
|
61
61
|
super(addition ?
|
|
@@ -67,7 +67,7 @@ const constructError = (name, message) => {
|
|
|
67
67
|
};
|
|
68
68
|
return ${name};
|
|
69
69
|
`;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const ErrorConstructor = (new Function('base', body))(BASE_MNEMONICA_ERROR);
|
|
71
|
+
return ErrorConstructor;
|
|
72
72
|
};
|
|
73
73
|
exports.constructError = constructError;
|
|
@@ -1,103 +1,103 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.throwModificationError = void 0;
|
|
4
|
-
const constants_1 = require(
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
5
|
const { odp, SymbolReplaceGaia, } = constants_1.constants;
|
|
6
|
-
const errors_1 = require(
|
|
6
|
+
const errors_1 = require("../../descriptors/errors");
|
|
7
7
|
const { BASE_MNEMONICA_ERROR } = errors_1.ErrorsTypes;
|
|
8
|
-
const _1 = require(
|
|
9
|
-
const utils_1 = require(
|
|
8
|
+
const _1 = require("./");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
10
|
const { makeFakeModificatorType } = utils_1.default;
|
|
11
|
-
const utils_2 = require(
|
|
11
|
+
const utils_2 = require("../../utils");
|
|
12
12
|
const { parse } = utils_2.utils;
|
|
13
|
-
const InstanceModificator_1 = require(
|
|
13
|
+
const InstanceModificator_1 = require("../types/InstanceModificator");
|
|
14
14
|
const throwModificationError = function (error) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
15
|
+
const self = this;
|
|
16
|
+
const { TypeName, type: { stack: typeStack }, args } = self;
|
|
17
|
+
const exceptionReason = error.exceptionReason || error;
|
|
18
|
+
if (error.exceptionReason !== undefined) {
|
|
19
|
+
error.reasons.push(error.exceptionReason);
|
|
20
|
+
error.surplus.push(error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
odp(error, 'exceptionReason', {
|
|
24
|
+
get() {
|
|
25
|
+
return exceptionReason;
|
|
26
|
+
},
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
const reasons = [exceptionReason];
|
|
30
|
+
odp(error, 'reasons', {
|
|
31
|
+
get() {
|
|
32
|
+
return reasons;
|
|
33
|
+
},
|
|
34
|
+
enumerable: true
|
|
35
|
+
});
|
|
36
|
+
const surplus = [];
|
|
37
|
+
odp(error, 'surplus', {
|
|
38
|
+
get() {
|
|
39
|
+
return surplus;
|
|
40
|
+
},
|
|
41
|
+
enumerable: true
|
|
42
|
+
});
|
|
43
|
+
self.ModificatorType = makeFakeModificatorType(TypeName);
|
|
44
|
+
self.InstanceModificator = (0, InstanceModificator_1.makeInstanceModificator)(self);
|
|
45
|
+
const erroredInstance = new self.InstanceModificator();
|
|
46
|
+
erroredInstance[SymbolReplaceGaia](error);
|
|
47
|
+
const stack = [];
|
|
48
|
+
if (error instanceof BASE_MNEMONICA_ERROR) {
|
|
49
|
+
stack.push(error.stack);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const title = `\n<-- creation of [ ${TypeName} ] traced -->`;
|
|
53
|
+
_1.getStack.call(erroredInstance, title, [], exports.throwModificationError);
|
|
54
|
+
stack.push(...erroredInstance.stack);
|
|
55
|
+
const errorStack = error.stack.split('\n');
|
|
56
|
+
stack.push('<-- with the following error -->');
|
|
57
|
+
errorStack.forEach((line) => {
|
|
58
|
+
if (!stack.includes(line)) {
|
|
59
|
+
stack.push(line);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
stack.push('\n<-- of constructor definitions stack -->');
|
|
63
|
+
stack.push(...typeStack);
|
|
64
|
+
}
|
|
65
|
+
erroredInstance.stack = (0, _1.cleanupStack)(stack).join('\n');
|
|
66
|
+
self.inheritedInstance = erroredInstance;
|
|
67
|
+
const results = self.invokePostHooks();
|
|
68
|
+
const { type, collection, namespace } = results;
|
|
69
|
+
if (type.has(true) || collection.has(true) || namespace.has(true)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
odp(erroredInstance, 'args', {
|
|
73
|
+
get() {
|
|
74
|
+
return args;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
odp(erroredInstance, 'originalError', {
|
|
78
|
+
get() {
|
|
79
|
+
return error;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
odp(erroredInstance, 'instance', {
|
|
83
|
+
get() {
|
|
84
|
+
return erroredInstance;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
odp(erroredInstance, 'extract', {
|
|
88
|
+
get() {
|
|
89
|
+
return () => {
|
|
90
|
+
return erroredInstance.__self__.extract();
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
odp(erroredInstance, 'parse', {
|
|
95
|
+
get() {
|
|
96
|
+
return () => {
|
|
97
|
+
return parse(erroredInstance);
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
throw erroredInstance;
|
|
102
102
|
};
|
|
103
103
|
exports.throwModificationError = throwModificationError;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
Object.defineProperty(exports,
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerFlowChecker = exports.flowCheckers = void 0;
|
|
4
|
-
const errors_1 = require(
|
|
4
|
+
const errors_1 = require("../../descriptors/errors");
|
|
5
5
|
const { MISSING_CALLBACK_ARGUMENT, FLOW_CHECKER_REDEFINITION, } = errors_1.ErrorsTypes;
|
|
6
6
|
exports.flowCheckers = new WeakMap();
|
|
7
7
|
const registerFlowChecker = function (cb) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
if (typeof cb !== 'function') {
|
|
9
|
+
throw new MISSING_CALLBACK_ARGUMENT;
|
|
10
|
+
}
|
|
11
|
+
if (exports.flowCheckers.has(this)) {
|
|
12
|
+
throw new FLOW_CHECKER_REDEFINITION;
|
|
13
|
+
}
|
|
14
|
+
exports.flowCheckers.set(this, cb);
|
|
15
15
|
};
|
|
16
16
|
exports.registerFlowChecker = registerFlowChecker;
|