@lakutata/core 1.0.58 → 1.0.60
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.
|
@@ -10,25 +10,35 @@ class Exception extends Error {
|
|
|
10
10
|
this.appName = process.env.appName ? process.env.appName : 'Unknown';
|
|
11
11
|
const _errArgs = Array.isArray(errArgs) ? errArgs : [errArgs];
|
|
12
12
|
this.message = (() => {
|
|
13
|
-
const argumentRegExs = [];
|
|
14
|
-
for (const errArg of _errArgs) {
|
|
15
|
-
argumentRegExs.push(new RegExp(errArg));
|
|
16
|
-
}
|
|
17
13
|
let errorMessage = null;
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
try {
|
|
15
|
+
const argumentRegExs = [];
|
|
16
|
+
for (const errArg of _errArgs) {
|
|
17
|
+
argumentRegExs.push(new RegExp(errArg));
|
|
18
|
+
}
|
|
19
|
+
for (const template of this.templates()) {
|
|
20
|
+
const str = pupa(template, _errArgs);
|
|
21
|
+
let satisfied = true;
|
|
22
|
+
try {
|
|
23
|
+
argumentRegExs.forEach(argumentRegEx => {
|
|
24
|
+
if (satisfied) {
|
|
25
|
+
if (!argumentRegEx.test(str))
|
|
26
|
+
satisfied = false;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
satisfied = false;
|
|
32
|
+
}
|
|
22
33
|
if (satisfied) {
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
errorMessage = str;
|
|
35
|
+
break;
|
|
25
36
|
}
|
|
26
|
-
});
|
|
27
|
-
if (satisfied) {
|
|
28
|
-
errorMessage = str;
|
|
29
|
-
break;
|
|
30
37
|
}
|
|
31
38
|
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
errorMessage = null;
|
|
41
|
+
}
|
|
32
42
|
if (errorMessage) {
|
|
33
43
|
return errorMessage;
|
|
34
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/base/abstracts/Exception.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+BAA2B;AAE3B,MAAsB,SAAU,SAAQ,KAAK;IAQ5C,YAAY,OAA0B;QACrC,KAAK,EAAE,CAAA;QANQ,UAAK,GAAW,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;QACjE,YAAO,GAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;QAMtF,MAAM,QAAQ,GAAa,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QACvE,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,EAAE;YACpB,MAAM,cAAc,GAAa,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"Exception.js","sourceRoot":"","sources":["../../../src/base/abstracts/Exception.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,+BAA2B;AAE3B,MAAsB,SAAU,SAAQ,KAAK;IAQ5C,YAAY,OAA0B;QACrC,KAAK,EAAE,CAAA;QANQ,UAAK,GAAW,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;QACjE,YAAO,GAAW,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;QAMtF,MAAM,QAAQ,GAAa,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,C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,OAAO,EAAE,CAAA;IACV,CAAC;CACD;AAhED,8BAgEC"}
|
package/package.json
CHANGED
|
@@ -13,23 +13,31 @@ export abstract class Exception extends Error {
|
|
|
13
13
|
super()
|
|
14
14
|
const _errArgs: string[] = Array.isArray(errArgs) ? errArgs : [errArgs]
|
|
15
15
|
this.message = (() => {
|
|
16
|
-
const argumentRegExs: RegExp[] = []
|
|
17
|
-
for (const errArg of _errArgs) {
|
|
18
|
-
argumentRegExs.push(new RegExp(errArg))
|
|
19
|
-
}
|
|
20
16
|
let errorMessage: string | null = null
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
try {
|
|
18
|
+
const argumentRegExs: RegExp[] = []
|
|
19
|
+
for (const errArg of _errArgs) {
|
|
20
|
+
argumentRegExs.push(new RegExp(errArg))
|
|
21
|
+
}
|
|
22
|
+
for (const template of this.templates()) {
|
|
23
|
+
const str = pupa(template, _errArgs)
|
|
24
|
+
let satisfied: boolean = true
|
|
25
|
+
try {
|
|
26
|
+
argumentRegExs.forEach(argumentRegEx => {
|
|
27
|
+
if (satisfied) {
|
|
28
|
+
if (!argumentRegEx.test(str)) satisfied = false
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
} catch (e) {
|
|
32
|
+
satisfied = false
|
|
33
|
+
}
|
|
25
34
|
if (satisfied) {
|
|
26
|
-
|
|
35
|
+
errorMessage = str
|
|
36
|
+
break
|
|
27
37
|
}
|
|
28
|
-
})
|
|
29
|
-
if (satisfied) {
|
|
30
|
-
errorMessage = str
|
|
31
|
-
break
|
|
32
38
|
}
|
|
39
|
+
} catch (e) {
|
|
40
|
+
errorMessage = null
|
|
33
41
|
}
|
|
34
42
|
if (errorMessage) {
|
|
35
43
|
return errorMessage
|