minimonolith 0.25.20 → 0.25.21
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/package.json +1 -1
- package/service/postRoute/handler.js +24 -2
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ export default async ({ body, ROUTE_CODE, SERVICES }) => {
|
|
|
16
16
|
|
|
17
17
|
let parsedInBody = inBody;
|
|
18
18
|
|
|
19
|
-
{
|
|
19
|
+
try {
|
|
20
20
|
const validationIn = await SERVICES.validation
|
|
21
21
|
.getParsedAsync.handler({ ROUTE_CODE: ROUTE_CODE+'_IN',
|
|
22
22
|
VALIDATOR: service.in, input: inBody });
|
|
@@ -29,6 +29,17 @@ export default async ({ body, ROUTE_CODE, SERVICES }) => {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (validationIn) parsedInBody = validationIn.parsedBody;
|
|
32
|
+
} catch (SERVICE_ERROR) {
|
|
33
|
+
const serviceRouteCode =
|
|
34
|
+
await SERVICES.service.getRouteCode.handler({
|
|
35
|
+
moduleName, serviceName });
|
|
36
|
+
|
|
37
|
+
await SERVICES.api.postError.handler({
|
|
38
|
+
[serviceRouteCode]: SERVICE_ERROR });
|
|
39
|
+
|
|
40
|
+
res.status(500).json({
|
|
41
|
+
[serviceRouteCode]: SERVICE_ERROR.toString() });
|
|
42
|
+
return;
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
let outBody = undefined;
|
|
@@ -55,7 +66,7 @@ export default async ({ body, ROUTE_CODE, SERVICES }) => {
|
|
|
55
66
|
|
|
56
67
|
let parsedOutBody = outBody;
|
|
57
68
|
|
|
58
|
-
{
|
|
69
|
+
try {
|
|
59
70
|
const validationOut = await SERVICES.validation
|
|
60
71
|
.getParsedAsync.handler({ ROUTE_CODE: ROUTE_CODE+'_OUT',
|
|
61
72
|
VALIDATOR: service.out, input: outBody });
|
|
@@ -68,6 +79,17 @@ export default async ({ body, ROUTE_CODE, SERVICES }) => {
|
|
|
68
79
|
}
|
|
69
80
|
|
|
70
81
|
if (validationOut) parsedOutBody = validationOut.parsedBody;
|
|
82
|
+
} catch (SERVICE_ERROR) {
|
|
83
|
+
const serviceRouteCode =
|
|
84
|
+
await SERVICES.service.getRouteCode.handler({
|
|
85
|
+
moduleName, serviceName });
|
|
86
|
+
|
|
87
|
+
await SERVICES.api.postError.handler({
|
|
88
|
+
[serviceRouteCode]: SERVICE_ERROR });
|
|
89
|
+
|
|
90
|
+
res.status(500).json({
|
|
91
|
+
[serviceRouteCode]: SERVICE_ERROR.toString() });
|
|
92
|
+
return;
|
|
71
93
|
}
|
|
72
94
|
|
|
73
95
|
const serviceResponseCode =
|