Skip to content

Commit e399716

Browse files
committed
fix: removed unnecessary meta set for api, bump deps
1 parent 0c2225e commit e399716

File tree

3 files changed

+1002
-829
lines changed

3 files changed

+1002
-829
lines changed

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,32 @@
2525
"toidentifier": "^1.0.0"
2626
},
2727
"devDependencies": {
28-
"@babel/cli": "^7.8.4",
29-
"@babel/core": "^7.9.6",
30-
"@babel/preset-env": "^7.9.6",
28+
"@babel/cli": "^7.10.1",
29+
"@babel/core": "^7.10.2",
30+
"@babel/preset-env": "^7.10.2",
3131
"@commitlint/cli": "^8.3.5",
3232
"@commitlint/config-conventional": "^8.3.4",
33-
"@koa/router": "^8.0.8",
34-
"ava": "2.x",
35-
"codecov": "^3.6.5",
33+
"@koa/router": "^9.0.1",
34+
"ava": "^3.8.2",
35+
"codecov": "^3.7.0",
3636
"cross-env": "^7.0.2",
3737
"eslint": "6.x",
3838
"eslint-config-xo-lass": "^1.0.3",
3939
"eslint-plugin-node": "^11.1.0",
4040
"fixpack": "^3.0.6",
4141
"husky": "^4.2.5",
42-
"koa": "^2.11.0",
42+
"koa": "^2.12.0",
4343
"koa-404-handler": "^0.0.2",
4444
"koa-basic-auth": "^4.0.0",
4545
"koa-connect-flash": "^0.1.2",
4646
"koa-convert": "^1.2.0",
4747
"koa-generic-session": "^2.0.4",
4848
"koa-redis": "^4.0.1",
49-
"lint-staged": "^10.2.2",
49+
"lint-staged": "^10.2.7",
5050
"nyc": "^15.0.1",
5151
"redis": "^3.0.2",
5252
"remark-cli": "^8.0.0",
53-
"remark-preset-github": "^1.0.0",
53+
"remark-preset-github": "^1.0.1",
5454
"supertest": "^4.0.2",
5555
"xo": "0.25"
5656
},

src/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,13 @@ async function errorHandler(err) {
115115
this.app.emit('error', err, this);
116116

117117
// fix page title and description
118-
this.state.meta = this.state.meta || {};
119-
this.state.meta.title = this.body.error;
120-
this.state.meta.description = err.message;
121-
debug('set `this.state.meta.title` to %s', this.state.meta.title);
122-
debug('set `this.state.meta.desc` to %s', this.state.meta.description);
118+
if (!this.api) {
119+
this.state.meta = this.state.meta || {};
120+
this.state.meta.title = this.body.error;
121+
this.state.meta.description = err.message;
122+
debug('set `this.state.meta.title` to %s', this.state.meta.title);
123+
debug('set `this.state.meta.desc` to %s', this.state.meta.description);
124+
}
123125

124126
debug('type was %s', type);
125127

0 commit comments

Comments
 (0)