Skip to content

Commit

Permalink
1. docs(error-handle): missing function keywords. (#1819)
Browse files Browse the repository at this point in the history
  • Loading branch information
AkashiX authored and atian25 committed Dec 12, 2017
1 parent 89e114c commit 7e05669
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/source/en/core/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ If you want a customized 404 response, you only need to create a middleware to h
```js
// app/middleware/notfound_handler.js
module.exports = () => {
return async notFoundHandler(ctx, next) {
return async function notFoundHandler(ctx, next) {
await next();
if (ctx.status === 404 && !ctx.body) {
if (ctx.acceptJSON) {
Expand Down
2 changes: 1 addition & 1 deletion docs/source/en/tutorials/restful.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class TopicController extends Controller {
// status = 422 exception will be thrown if not passing the parameter validation
ctx.validate(createRule);
// call service to create a topic
const id = yield ctx.service.topics.create(ctx.request.body);
const id = await ctx.service.topics.create(ctx.request.body);
// configure the response body and status code
ctx.body = {
topic_id: id,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/core/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ module.exports = {
```js
// app/middleware/notfound_handler.js
module.exports = () => {
return async notFoundHandler(ctx, next) {
return async function notFoundHandler(ctx, next) {
await next();
if (ctx.status === 404 && !ctx.body) {
if (ctx.acceptJSON) {
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/tutorials/restful.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class TopicController extends Controller {
// 如果参数校验未通过,将会抛出一个 status = 422 的异常
ctx.validate(createRule);
// 调用 service 创建一个 topic
const id = yield ctx.service.topics.create(ctx.request.body);
const id = await ctx.service.topics.create(ctx.request.body);
// 设置响应体和状态码
ctx.body = {
topic_id: id,
Expand Down

0 comments on commit 7e05669

Please sign in to comment.