@cryptexlabs/codex-nodejs-common 0.14.0 → 0.14.2
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/lib/package.json +1 -1
- package/lib/src/logger/context.logger.js +15 -15
- package/lib/src/logger/context.logger.js.map +1 -1
- package/lib/src/logger/log-watcher.interface.d.ts +6 -2
- package/lib/src/util/locale.util.js +6 -1
- package/lib/src/util/locale.util.js.map +1 -1
- package/package.json +1 -1
- package/src/logger/context.logger.ts +90 -15
- package/src/logger/log-watcher.interface.ts +36 -3
- package/src/util/locale.util.ts +11 -7
package/lib/package.json
CHANGED
|
@@ -16,16 +16,16 @@ class ContextLogger {
|
|
|
16
16
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
17
17
|
ContextLogger._contextWatchers
|
|
18
18
|
.get(this.correlationId)
|
|
19
|
-
.debug(message, this._getData(data));
|
|
19
|
+
.debug(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
20
20
|
for (const watcher of this._watchers.values()) {
|
|
21
21
|
if (watcher.correlationId !== this.correlationId) {
|
|
22
|
-
watcher.debug(message, this._getData(data));
|
|
22
|
+
watcher.debug(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
for (const watcher of this._watchers.values()) {
|
|
28
|
-
watcher.debug(message, this._getData(data));
|
|
28
|
+
watcher.debug(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -34,16 +34,16 @@ class ContextLogger {
|
|
|
34
34
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
35
35
|
ContextLogger._contextWatchers
|
|
36
36
|
.get(this.correlationId)
|
|
37
|
-
.error(message, this._getData(data));
|
|
37
|
+
.error(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
38
38
|
for (const watcher of this._watchers.values()) {
|
|
39
39
|
if (watcher.correlationId !== this.correlationId) {
|
|
40
|
-
watcher.error(message, this._getData(data));
|
|
40
|
+
watcher.error(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
for (const watcher of this._watchers.values()) {
|
|
46
|
-
watcher.error(message, this._getData(data));
|
|
46
|
+
watcher.error(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -52,16 +52,16 @@ class ContextLogger {
|
|
|
52
52
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
53
53
|
ContextLogger._contextWatchers
|
|
54
54
|
.get(this.correlationId)
|
|
55
|
-
.log(message, this._getData(data));
|
|
55
|
+
.log(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
56
56
|
for (const watcher of this._watchers.values()) {
|
|
57
57
|
if (watcher.correlationId !== this.correlationId) {
|
|
58
|
-
watcher.log(message, this._getData(data));
|
|
58
|
+
watcher.log(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
for (const watcher of this._watchers.values()) {
|
|
64
|
-
watcher.log(message, this._getData(data));
|
|
64
|
+
watcher.log(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -70,16 +70,16 @@ class ContextLogger {
|
|
|
70
70
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
71
71
|
ContextLogger._contextWatchers
|
|
72
72
|
.get(this.correlationId)
|
|
73
|
-
.verbose(message, this._getData(data));
|
|
73
|
+
.verbose(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
74
74
|
for (const watcher of this._watchers.values()) {
|
|
75
75
|
if (watcher.correlationId !== this.correlationId) {
|
|
76
|
-
watcher.verbose(message, this._getData(data));
|
|
76
|
+
watcher.verbose(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
81
|
for (const watcher of this._watchers.values()) {
|
|
82
|
-
watcher.verbose(message, this._getData(data));
|
|
82
|
+
watcher.verbose(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -88,16 +88,16 @@ class ContextLogger {
|
|
|
88
88
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
89
89
|
ContextLogger._contextWatchers
|
|
90
90
|
.get(this.correlationId)
|
|
91
|
-
.warn(message, this._getData(data));
|
|
91
|
+
.warn(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
92
92
|
for (const watcher of this._watchers.values()) {
|
|
93
93
|
if (watcher.correlationId !== this.correlationId) {
|
|
94
|
-
watcher.warn(message, this._getData(data));
|
|
94
|
+
watcher.warn(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
for (const watcher of this._watchers.values()) {
|
|
100
|
-
watcher.warn(message, this._getData(data));
|
|
100
|
+
watcher.warn(message, this.correlationId, this._stackTraceId, this._getData(data));
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.logger.js","sourceRoot":"","sources":["../../../src/logger/context.logger.ts"],"names":[],"mappings":";;;AACA,+BAAoC;AAMpC,MAAa,aAAa;IAMxB,YACmB,aAAqB,EACrB,MAAqB,EACrB,MAAuB,EACvB,MAAqB;QAHrB,kBAAa,GAAb,aAAa,CAAQ;QACrB,WAAM,GAAN,MAAM,CAAe;QACrB,WAAM,GAAN,MAAM,CAAiB;QACvB,WAAM,GAAN,MAAM,CAAe;QANhC,cAAS,GAAqC,IAAI,GAAG,E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C,CAAC;QAEF,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,mCACF,OAAO,KACV,IAAI,GACL,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;;AAxOH,sCAyOC;AAtOgB,8BAAgB,GAAqC,IAAI,GAAG,EAAE,AAA9C,CAA+C"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export interface LogWatcherInterface extends LoggerService {
|
|
1
|
+
export interface LogWatcherInterface {
|
|
3
2
|
name: string;
|
|
4
3
|
id: string;
|
|
5
4
|
correlationId: string;
|
|
5
|
+
log(message: string, correlationId: string, stackTraceId: string, ...optionalParams: any[]): void;
|
|
6
|
+
error(message: string, correlationId: string, stackTraceId: string, ...optionalParams: any[]): void;
|
|
7
|
+
warn(message: string, correlationId: string, stackTraceId: string, ...optionalParams: any[]): void;
|
|
8
|
+
debug(message: string, correlationId: string, stackTraceId: string, ...optionalParams: any[]): void;
|
|
9
|
+
verbose(message: string, correlationId: string, stackTraceId: string, ...optionalParams: any[]): void;
|
|
6
10
|
}
|
|
@@ -8,7 +8,12 @@ const locales_1 = require("../locales/locales");
|
|
|
8
8
|
class LocaleUtil {
|
|
9
9
|
static getLocaleFromAcceptLanguageHeader(context, langCode) {
|
|
10
10
|
if (!langCode) {
|
|
11
|
-
|
|
11
|
+
if (process.env.FALLBACK_LANGUAGE) {
|
|
12
|
+
langCode = process.env.FALLBACK_LANGUAGE;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
throw new exception_1.FriendlyHttpException(`Accept language header is not set`, context, locales_1.i18nData.__({ phrase: "an-error-occurred", locale: "en-US" }), common_1.HttpStatus.BAD_REQUEST, "LocaleUtil\ngetLocaleFromAcceptLanguageHeader");
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
18
|
const parts = langCode.split("-");
|
|
14
19
|
let language;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.util.js","sourceRoot":"","sources":["../../../src/util/locale.util.ts"],"names":[],"mappings":";;;AAAA,oEAOuC;AACvC,2CAA4C;AAC5C,4CAAqD;AAErD,gDAA8C;AAE9C,MAAa,UAAU;IACd,MAAM,CAAC,iCAAiC,CAC7C,OAAgB,EAChB,QAAgB;QAEhB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,iCAAqB,CAC7B,mCAAmC,EACnC,OAAO,EACP,kBAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAC7D,mBAAU,CAAC,WAAW,EACtB,+CAA+C,CAChD,CAAC;
|
|
1
|
+
{"version":3,"file":"locale.util.js","sourceRoot":"","sources":["../../../src/util/locale.util.ts"],"names":[],"mappings":";;;AAAA,oEAOuC;AACvC,2CAA4C;AAC5C,4CAAqD;AAErD,gDAA8C;AAE9C,MAAa,UAAU;IACd,MAAM,CAAC,iCAAiC,CAC7C,OAAgB,EAChB,QAAgB;QAEhB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;gBAClC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,iCAAqB,CAC7B,mCAAmC,EACnC,OAAO,EACP,kBAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAC7D,mBAAU,CAAC,WAAW,EACtB,+CAA+C,CAChD,CAAC;YACJ,CAAC;QACH,CAAC;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,QAAgB,CAAC;QACrB,IAAI,OAAe,CAAC;QAEpB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,QAAQ,CAAC,KA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I,EAAE,CAAC;gBAC3C,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhC,IAAI,CAAC,qCAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,iCAAqB,CAC7B,0BAA0B,OAAO,EAAE,EACnC,OAAO,EACP,kBAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAClE,mBAAU,CAAC,cAAc,EACzB,+CAA+C,CAChD,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,oCAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,iCAAqB,CAC7B,yBAAyB,OAAO,EAAE,EAClC,OAAO,EACP,kBAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAClE,mBAAU,CAAC,cAAc,EACzB,+CAA+C,CAChD,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,yBAAM,CAAC,QAAwB,EAAE,OAAsB,CAAC,CAAC;IACtE,CAAC;IAEM,MAAM,CAAC,oBAAoB,CAChC,OAAgC,EAChC,OAAgB;QAEhB,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC,iCAAiC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACnE,CAAC;CACF;AApFD,gCAoFC"}
|
package/package.json
CHANGED
|
@@ -26,15 +26,30 @@ export class ContextLogger implements LoggerService {
|
|
|
26
26
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
27
27
|
ContextLogger._contextWatchers
|
|
28
28
|
.get(this.correlationId)
|
|
29
|
-
.debug(
|
|
29
|
+
.debug(
|
|
30
|
+
message,
|
|
31
|
+
this.correlationId,
|
|
32
|
+
this._stackTraceId,
|
|
33
|
+
this._getData(data)
|
|
34
|
+
);
|
|
30
35
|
for (const watcher of this._watchers.values()) {
|
|
31
36
|
if (watcher.correlationId !== this.correlationId) {
|
|
32
|
-
watcher.debug(
|
|
37
|
+
watcher.debug(
|
|
38
|
+
message,
|
|
39
|
+
this.correlationId,
|
|
40
|
+
this._stackTraceId,
|
|
41
|
+
this._getData(data)
|
|
42
|
+
);
|
|
33
43
|
}
|
|
34
44
|
}
|
|
35
45
|
} else {
|
|
36
46
|
for (const watcher of this._watchers.values()) {
|
|
37
|
-
watcher.debug(
|
|
47
|
+
watcher.debug(
|
|
48
|
+
message,
|
|
49
|
+
this.correlationId,
|
|
50
|
+
this._stackTraceId,
|
|
51
|
+
this._getData(data)
|
|
52
|
+
);
|
|
38
53
|
}
|
|
39
54
|
}
|
|
40
55
|
}
|
|
@@ -44,15 +59,30 @@ export class ContextLogger implements LoggerService {
|
|
|
44
59
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
45
60
|
ContextLogger._contextWatchers
|
|
46
61
|
.get(this.correlationId)
|
|
47
|
-
.error(
|
|
62
|
+
.error(
|
|
63
|
+
message,
|
|
64
|
+
this.correlationId,
|
|
65
|
+
this._stackTraceId,
|
|
66
|
+
this._getData(data)
|
|
67
|
+
);
|
|
48
68
|
for (const watcher of this._watchers.values()) {
|
|
49
69
|
if (watcher.correlationId !== this.correlationId) {
|
|
50
|
-
watcher.error(
|
|
70
|
+
watcher.error(
|
|
71
|
+
message,
|
|
72
|
+
this.correlationId,
|
|
73
|
+
this._stackTraceId,
|
|
74
|
+
this._getData(data)
|
|
75
|
+
);
|
|
51
76
|
}
|
|
52
77
|
}
|
|
53
78
|
} else {
|
|
54
79
|
for (const watcher of this._watchers.values()) {
|
|
55
|
-
watcher.error(
|
|
80
|
+
watcher.error(
|
|
81
|
+
message,
|
|
82
|
+
this.correlationId,
|
|
83
|
+
this._stackTraceId,
|
|
84
|
+
this._getData(data)
|
|
85
|
+
);
|
|
56
86
|
}
|
|
57
87
|
}
|
|
58
88
|
}
|
|
@@ -62,15 +92,30 @@ export class ContextLogger implements LoggerService {
|
|
|
62
92
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
63
93
|
ContextLogger._contextWatchers
|
|
64
94
|
.get(this.correlationId)
|
|
65
|
-
.log(
|
|
95
|
+
.log(
|
|
96
|
+
message,
|
|
97
|
+
this.correlationId,
|
|
98
|
+
this._stackTraceId,
|
|
99
|
+
this._getData(data)
|
|
100
|
+
);
|
|
66
101
|
for (const watcher of this._watchers.values()) {
|
|
67
102
|
if (watcher.correlationId !== this.correlationId) {
|
|
68
|
-
watcher.log(
|
|
103
|
+
watcher.log(
|
|
104
|
+
message,
|
|
105
|
+
this.correlationId,
|
|
106
|
+
this._stackTraceId,
|
|
107
|
+
this._getData(data)
|
|
108
|
+
);
|
|
69
109
|
}
|
|
70
110
|
}
|
|
71
111
|
} else {
|
|
72
112
|
for (const watcher of this._watchers.values()) {
|
|
73
|
-
watcher.log(
|
|
113
|
+
watcher.log(
|
|
114
|
+
message,
|
|
115
|
+
this.correlationId,
|
|
116
|
+
this._stackTraceId,
|
|
117
|
+
this._getData(data)
|
|
118
|
+
);
|
|
74
119
|
}
|
|
75
120
|
}
|
|
76
121
|
}
|
|
@@ -80,15 +125,30 @@ export class ContextLogger implements LoggerService {
|
|
|
80
125
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
81
126
|
ContextLogger._contextWatchers
|
|
82
127
|
.get(this.correlationId)
|
|
83
|
-
.verbose(
|
|
128
|
+
.verbose(
|
|
129
|
+
message,
|
|
130
|
+
this.correlationId,
|
|
131
|
+
this._stackTraceId,
|
|
132
|
+
this._getData(data)
|
|
133
|
+
);
|
|
84
134
|
for (const watcher of this._watchers.values()) {
|
|
85
135
|
if (watcher.correlationId !== this.correlationId) {
|
|
86
|
-
watcher.verbose(
|
|
136
|
+
watcher.verbose(
|
|
137
|
+
message,
|
|
138
|
+
this.correlationId,
|
|
139
|
+
this._stackTraceId,
|
|
140
|
+
this._getData(data)
|
|
141
|
+
);
|
|
87
142
|
}
|
|
88
143
|
}
|
|
89
144
|
} else {
|
|
90
145
|
for (const watcher of this._watchers.values()) {
|
|
91
|
-
watcher.verbose(
|
|
146
|
+
watcher.verbose(
|
|
147
|
+
message,
|
|
148
|
+
this.correlationId,
|
|
149
|
+
this._stackTraceId,
|
|
150
|
+
this._getData(data)
|
|
151
|
+
);
|
|
92
152
|
}
|
|
93
153
|
}
|
|
94
154
|
}
|
|
@@ -98,15 +158,30 @@ export class ContextLogger implements LoggerService {
|
|
|
98
158
|
if (ContextLogger._contextWatchers.has(this.correlationId)) {
|
|
99
159
|
ContextLogger._contextWatchers
|
|
100
160
|
.get(this.correlationId)
|
|
101
|
-
.warn(
|
|
161
|
+
.warn(
|
|
162
|
+
message,
|
|
163
|
+
this.correlationId,
|
|
164
|
+
this._stackTraceId,
|
|
165
|
+
this._getData(data)
|
|
166
|
+
);
|
|
102
167
|
for (const watcher of this._watchers.values()) {
|
|
103
168
|
if (watcher.correlationId !== this.correlationId) {
|
|
104
|
-
watcher.warn(
|
|
169
|
+
watcher.warn(
|
|
170
|
+
message,
|
|
171
|
+
this.correlationId,
|
|
172
|
+
this._stackTraceId,
|
|
173
|
+
this._getData(data)
|
|
174
|
+
);
|
|
105
175
|
}
|
|
106
176
|
}
|
|
107
177
|
} else {
|
|
108
178
|
for (const watcher of this._watchers.values()) {
|
|
109
|
-
watcher.warn(
|
|
179
|
+
watcher.warn(
|
|
180
|
+
message,
|
|
181
|
+
this.correlationId,
|
|
182
|
+
this._stackTraceId,
|
|
183
|
+
this._getData(data)
|
|
184
|
+
);
|
|
110
185
|
}
|
|
111
186
|
}
|
|
112
187
|
}
|
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface LogWatcherInterface extends LoggerService {
|
|
1
|
+
export interface LogWatcherInterface {
|
|
4
2
|
name: string;
|
|
5
3
|
id: string;
|
|
6
4
|
correlationId: string;
|
|
5
|
+
|
|
6
|
+
log(
|
|
7
|
+
message: string,
|
|
8
|
+
correlationId: string,
|
|
9
|
+
stackTraceId: string,
|
|
10
|
+
...optionalParams: any[]
|
|
11
|
+
): void;
|
|
12
|
+
|
|
13
|
+
error(
|
|
14
|
+
message: string,
|
|
15
|
+
correlationId: string,
|
|
16
|
+
stackTraceId: string,
|
|
17
|
+
...optionalParams: any[]
|
|
18
|
+
): void;
|
|
19
|
+
|
|
20
|
+
warn(
|
|
21
|
+
message: string,
|
|
22
|
+
correlationId: string,
|
|
23
|
+
stackTraceId: string,
|
|
24
|
+
...optionalParams: any[]
|
|
25
|
+
): void;
|
|
26
|
+
|
|
27
|
+
debug(
|
|
28
|
+
message: string,
|
|
29
|
+
correlationId: string,
|
|
30
|
+
stackTraceId: string,
|
|
31
|
+
...optionalParams: any[]
|
|
32
|
+
): void;
|
|
33
|
+
|
|
34
|
+
verbose(
|
|
35
|
+
message: string,
|
|
36
|
+
correlationId: string,
|
|
37
|
+
stackTraceId: string,
|
|
38
|
+
...optionalParams: any[]
|
|
39
|
+
): void;
|
|
7
40
|
}
|
package/src/util/locale.util.ts
CHANGED
|
@@ -17,13 +17,17 @@ export class LocaleUtil {
|
|
|
17
17
|
langCode: string
|
|
18
18
|
) {
|
|
19
19
|
if (!langCode) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
if (process.env.FALLBACK_LANGUAGE) {
|
|
21
|
+
langCode = process.env.FALLBACK_LANGUAGE;
|
|
22
|
+
} else {
|
|
23
|
+
throw new FriendlyHttpException(
|
|
24
|
+
`Accept language header is not set`,
|
|
25
|
+
context,
|
|
26
|
+
i18nData.__({ phrase: "an-error-occurred", locale: "en-US" }),
|
|
27
|
+
HttpStatus.BAD_REQUEST,
|
|
28
|
+
"LocaleUtil\ngetLocaleFromAcceptLanguageHeader"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
const parts = langCode.split("-");
|
|
29
33
|
let language: string;
|