@azteam/express 1.2.471 → 1.2.473

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 CHANGED
@@ -339,19 +339,16 @@ var Server = /*#__PURE__*/function () {
339
339
  app.use(function () {
340
340
  throw new _error.ErrorException(_error.NOT_FOUND);
341
341
  });
342
- app.use(function (err, req, res) {
342
+ app.use(function (err, req, res, next) {
343
343
  var error = (0, _error.errorCatch)(err);
344
344
  if (process.env.NODE_ENV === 'development') {
345
345
  console.log(error.errors);
346
346
  }
347
347
  if (_this4.callbackError) {
348
- if (_this4.callbackError) {
349
- _this4.callbackError(error, {
350
- method: req.method,
351
- path: req.originalUrl,
352
- body: req.body
353
- });
354
- }
348
+ _this4.callbackError(error, req.originalUrl);
349
+ }
350
+ if (req.callbackError) {
351
+ req.callbackError(error);
355
352
  }
356
353
  if (error.errors[0].code === _error.UNKNOWN) {
357
354
  error.errors[0].message = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.471",
3
+ "version": "1.2.473",
4
4
  "license": "MIT",
5
5
  "author": "toda <sp.azsolution.net@gmail.com>",
6
6
  "main": "./lib/index.js",
package/src/Server.js CHANGED
@@ -312,20 +312,18 @@ class Server {
312
312
  throw new ErrorException(NOT_FOUND);
313
313
  });
314
314
 
315
- app.use((err, req, res) => {
315
+ app.use((err, req, res, next) => {
316
316
  const error = errorCatch(err);
317
317
  if (process.env.NODE_ENV === 'development') {
318
318
  console.log(error.errors);
319
319
  }
320
320
  if (this.callbackError) {
321
- if (this.callbackError) {
322
- this.callbackError(error, {
323
- method: req.method,
324
- path: req.originalUrl,
325
- body: req.body,
326
- });
327
- }
321
+ this.callbackError(error, req.originalUrl);
328
322
  }
323
+ if (req.callbackError) {
324
+ req.callbackError(error);
325
+ }
326
+
329
327
  if (error.errors[0].code === UNKNOWN) {
330
328
  error.errors[0].message = '';
331
329
  }