ti2 1.0.26 → 1.0.27
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 +5 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -203,15 +203,13 @@ module.exports = async ({
|
|
|
203
203
|
app.use(middleware.mock());
|
|
204
204
|
// global error Handling
|
|
205
205
|
app.use((err, req, res) => {
|
|
206
|
-
if (process.env.CONSOLE_ERRORS) {
|
|
206
|
+
if (process.env.CONSOLE_ERRORS || process.env.JEST_WORKER_ID) {
|
|
207
207
|
console.error(err);
|
|
208
208
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
return res.json({
|
|
209
|
+
return res.status((() => {
|
|
210
|
+
if (isNan(err.status)) return 500;
|
|
211
|
+
return parseInt(err.status, 10);
|
|
212
|
+
})()).json({
|
|
215
213
|
message: err.message || 'Internal Error',
|
|
216
214
|
});
|
|
217
215
|
});
|