{"action":"reopened","issue":{"url":"https://api.github.com/repos/eggjs/egg/issues/2609","repository_url":"https://api.github.com/repos/eggjs/egg","labels_url":"https://api.github.com/repos/eggjs/egg/issues/2609/labels{/name}","comments_url":"https://api.github.com/repos/eggjs/egg/issues/2609/comments","events_url":"https://api.github.com/repos/eggjs/egg/issues/2609/events","html_url":"https://github.com/eggjs/egg/issues/2609","id":327175734,"number":2609,"title":"runInBackground 捕获不到 错误 ","user":{"login":"robert7git","id":6889441,"avatar_url":"https://avatars2.githubusercontent.com/u/6889441?v=4","gravatar_id":"","url":"https://api.github.com/users/robert7git","html_url":"https://github.com/robert7git","followers_url":"https://api.github.com/users/robert7git/followers","following_url":"https://api.github.com/users/robert7git/following{/other_user}","gists_url":"https://api.github.com/users/robert7git/gists{/gist_id}","starred_url":"https://api.github.com/users/robert7git/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robert7git/subscriptions","organizations_url":"https://api.github.com/users/robert7git/orgs","repos_url":"https://api.github.com/users/robert7git/repos","events_url":"https://api.github.com/users/robert7git/events{/privacy}","received_events_url":"https://api.github.com/users/robert7git/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-29T05:37:16Z","updated_at":"2018-05-29T06:47:22Z","closed_at":null,"author_association":"NONE","body":"<!--\r\nThank you for reporting an issue.\r\n\r\n1. It's RECOMMENDED to submit PR for typo or tiny bug fix.\r\n2. If this's a FEATURE request, please provide: details, pseudo codes if necessary.\r\n3. If this's a BUG, please provide: course repetition, error log and configuration. Fill in as much of the template below as you're able.\r\n4. It will be nice to use `egg-init --type=simple bug` to provide a mini GitHub repository which can reproduce the issue.\r\n\r\n感谢您向我们反馈问题。\r\n\r\n1. 提交问题前，请先阅读 https://eggjs.org/zh-cn/faq.html\r\n2. 我们推荐如果是小问题（错别字修改，小的 bug fix）直接提交 PR。\r\n3. 如果是一个新需求，请提供：详细需求描述，最好是有伪代码实现。\r\n4. 如果是一个 BUG，请提供：复现步骤，错误日志以及相关配置，并尽量填写下面的模板中的条目。\r\n5. 如果可以，请使用 `egg-init --type=simple bug` 提供一个最小可复现的代码仓库，方便我们排查问题。\r\n6. 扩展阅读：[如何向开源项目提交无法解答的问题](https://zhuanlan.zhihu.com/p/25795393)\r\n-->\r\n\r\n* **Node Version**:  v8.9.3\r\n* **Egg Version**: ^2.2.1\r\n* **Plugin Name**:\r\n* **Plugin Version**:\r\n* **Platform**:\r\n* **Mini Showcase Repository**:\r\n\r\n<!-- Enter your issue details below this comment. -->\r\n之前在 文档里看到，如果用 try 捕获异常 多个 await 串 ，中的 错误不会被捕获。\r\n文档里说     ctx.runInBackground(async ()  可以捕获。\r\n但是，根本没报错。\r\n是我用错了吗。\r\n```\r\nservice code:\r\n    ctx.runInBackground(async () => {\r\n      return await this.ctx.model.Article.findAll({\r\n        order: [[ 'id', sortStr ]],\r\n        offset: (page - 1) * pageSize,\r\n        limit: pageSize,\r\n        include: [\r\n          { model: ctx.model.User, as: 'user', attributes: [ 'id', 'name', 'sex' ] },\r\n          { model: ctx.model.Tag, as: 'tags', through: { attributes: [] } },\r\n          { model: ctx.model.Cate, attributes: [ 'id', 'name' ] },\r\n          { model: ctx.model.Comment, as: 'comments' },\r\n        ],\r\n      }).then(function(docs) {\r\n        return { rows: docs.length !== 0 ? docs : [] };\r\n      });\r\n    });\r\n```"}}
{"actor":{"display_login":"ngot"}}