q-koa 11.4.5 → 11.4.6
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/core/app.js +2 -0
- package/core/errors.js +8 -0
- package/core/middlewares.js +1 -1
- package/package.json +1 -1
package/core/app.js
CHANGED
|
@@ -42,6 +42,7 @@ const {
|
|
|
42
42
|
miLimit,
|
|
43
43
|
} = require('./middlewares')
|
|
44
44
|
const Validator = require('./validator')
|
|
45
|
+
const { ServiceError } = require('./errors')
|
|
45
46
|
|
|
46
47
|
let spinner
|
|
47
48
|
|
|
@@ -1930,6 +1931,7 @@ APP.Sequelize = Sequelize
|
|
|
1930
1931
|
APP.lodash = _
|
|
1931
1932
|
APP.Random = Random
|
|
1932
1933
|
APP.Validator = Validator
|
|
1934
|
+
APP.ServiceError = ServiceError
|
|
1933
1935
|
APP.moment = moment
|
|
1934
1936
|
global.moment = moment
|
|
1935
1937
|
global.Sequelize = Sequelize
|
package/core/errors.js
ADDED
package/core/middlewares.js
CHANGED
|
@@ -30,7 +30,7 @@ exports.miErrors = () => async (ctx, next) => {
|
|
|
30
30
|
content: e.stack,
|
|
31
31
|
header: ctx.request.header,
|
|
32
32
|
}
|
|
33
|
-
if (app && app.model && app.model.log) {
|
|
33
|
+
if (['service'].includes(e.type) && app && app.model && app.model.log) {
|
|
34
34
|
app.model.log.upsert(errorData)
|
|
35
35
|
}
|
|
36
36
|
|