@steedos/service-api 2.6.2-beta.9 → 2.6.4-beta.1
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/index.js +32 -13
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -65,9 +65,14 @@ const mixinOptions = {
|
|
|
65
65
|
logging: true,
|
|
66
66
|
// Route error handler
|
|
67
67
|
onError(req, res, err) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
try {
|
|
69
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
70
|
+
res.writeHead(err.code || 500);
|
|
71
|
+
res.end(JSON.stringify(err));
|
|
72
|
+
} catch (Exception) {
|
|
73
|
+
res.writeHead(500);
|
|
74
|
+
res.end(JSON.stringify(err));
|
|
75
|
+
}
|
|
71
76
|
}
|
|
72
77
|
},
|
|
73
78
|
|
|
@@ -213,9 +218,14 @@ module.exports = {
|
|
|
213
218
|
|
|
214
219
|
// Route error handler
|
|
215
220
|
onError(req, res, err) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
221
|
+
try {
|
|
222
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
223
|
+
res.writeHead(err.code || 500);
|
|
224
|
+
res.end(JSON.stringify({ error: err.message, detail: err }));
|
|
225
|
+
} catch (error) {
|
|
226
|
+
res.writeHead(500);
|
|
227
|
+
res.end(JSON.stringify({ error: err.message}));
|
|
228
|
+
}
|
|
219
229
|
}
|
|
220
230
|
},
|
|
221
231
|
{
|
|
@@ -292,13 +302,22 @@ module.exports = {
|
|
|
292
302
|
|
|
293
303
|
// Route error handler
|
|
294
304
|
onError(req, res, err) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
305
|
+
try {
|
|
306
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
307
|
+
res.writeHead(err.code || 500);
|
|
308
|
+
res.end(JSON.stringify({
|
|
309
|
+
"status": -1,
|
|
310
|
+
"msg": err.message,
|
|
311
|
+
"data": {}
|
|
312
|
+
}));
|
|
313
|
+
} catch (Exception) {
|
|
314
|
+
res.writeHead(500);
|
|
315
|
+
res.end(JSON.stringify({
|
|
316
|
+
"status": -1,
|
|
317
|
+
"msg": err.message,
|
|
318
|
+
"data": {}
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
302
321
|
}
|
|
303
322
|
}
|
|
304
323
|
],
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-api",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4-beta.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@steedos/auth": "2.6.
|
|
8
|
-
"@steedos/router": "2.6.
|
|
9
|
-
"@steedos/service-object-graphql": "2.6.
|
|
10
|
-
"@steedos/service-ui": "2.6.
|
|
7
|
+
"@steedos/auth": "2.6.4-beta.1",
|
|
8
|
+
"@steedos/router": "2.6.4-beta.1",
|
|
9
|
+
"@steedos/service-object-graphql": "2.6.4-beta.1",
|
|
10
|
+
"@steedos/service-ui": "2.6.4-beta.1",
|
|
11
11
|
"graphql": "^15.8.0",
|
|
12
12
|
"graphql-iso-date": "^3.6.1",
|
|
13
13
|
"graphql-type-json": "^0.3.2",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "3c48181d4c11b106c75f3618d9557e628242cba9",
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/graphql-iso-date": "^3.4.0",
|
|
28
28
|
"@types/react-dev-utils": "^9.0.11"
|