egg 3.17.3 → 3.17.5
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/config/config.default.js
CHANGED
|
@@ -236,8 +236,15 @@ module.exports = appInfo => {
|
|
|
236
236
|
depth: 5,
|
|
237
237
|
parameterLimit: 1000,
|
|
238
238
|
},
|
|
239
|
-
onerror(err) {
|
|
239
|
+
onerror(err, ctx) {
|
|
240
240
|
err.message += ', check bodyParser config';
|
|
241
|
+
if (ctx.status === 404) {
|
|
242
|
+
// set default status to 400, meaning client bad request
|
|
243
|
+
ctx.status = 400;
|
|
244
|
+
if (!err.status) {
|
|
245
|
+
err.status = 400;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
241
248
|
throw err;
|
|
242
249
|
},
|
|
243
250
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
const CALL = Symbol('BaseContextLogger#call');
|
|
4
2
|
|
|
5
3
|
class BaseContextLogger {
|
|
6
|
-
|
|
7
4
|
/**
|
|
8
5
|
* @class
|
|
9
6
|
* @param {Context} ctx - context instance
|
|
@@ -24,7 +21,7 @@ class BaseContextLogger {
|
|
|
24
21
|
if (this.pathName && typeof args[0] === 'string') {
|
|
25
22
|
args[0] = `[${this.pathName}] ${args[0]}`;
|
|
26
23
|
}
|
|
27
|
-
this.ctx.logger[method](...args);
|
|
24
|
+
this.ctx.app.logger[method](...args);
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
/**
|