@azteam/express 1.2.487 → 1.2.488
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/Server.js +1 -3
- package/package.json +1 -1
- package/src/Server.js +3 -4
package/lib/Server.js
CHANGED
|
@@ -341,6 +341,7 @@ var Server = /*#__PURE__*/function () {
|
|
|
341
341
|
});
|
|
342
342
|
app.use(function (err, req, res, next) {
|
|
343
343
|
var error = (0, _error.errorCatch)(err);
|
|
344
|
+
error.url = req.originalUrl;
|
|
344
345
|
if (process.env.NODE_ENV === 'development') {
|
|
345
346
|
console.log(error.errors);
|
|
346
347
|
}
|
|
@@ -353,9 +354,6 @@ var Server = /*#__PURE__*/function () {
|
|
|
353
354
|
if (error.errors[0].code === _error.UNKNOWN) {
|
|
354
355
|
error.errors[0].message = '';
|
|
355
356
|
}
|
|
356
|
-
if (error.errors[0].code === _error.NOT_FOUND) {
|
|
357
|
-
error.errors[0].url = req.originalUrl;
|
|
358
|
-
}
|
|
359
357
|
return res.status(error.status).json({
|
|
360
358
|
success: false,
|
|
361
359
|
errors: error.errors
|
package/package.json
CHANGED
package/src/Server.js
CHANGED
|
@@ -314,6 +314,9 @@ class Server {
|
|
|
314
314
|
|
|
315
315
|
app.use((err, req, res, next) => {
|
|
316
316
|
const error = errorCatch(err);
|
|
317
|
+
|
|
318
|
+
error.url = req.originalUrl;
|
|
319
|
+
|
|
317
320
|
if (process.env.NODE_ENV === 'development') {
|
|
318
321
|
console.log(error.errors);
|
|
319
322
|
}
|
|
@@ -328,10 +331,6 @@ class Server {
|
|
|
328
331
|
error.errors[0].message = '';
|
|
329
332
|
}
|
|
330
333
|
|
|
331
|
-
if (error.errors[0].code === NOT_FOUND) {
|
|
332
|
-
error.errors[0].url = req.originalUrl;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
334
|
return res.status(error.status).json({success: false, errors: error.errors});
|
|
336
335
|
});
|
|
337
336
|
|