diff --git a/.github/ISSUE_TEMPLATE/bug_report_en.md b/.github/ISSUE_TEMPLATE/bug_report_en.md index 7d40bd58d..3e0db32e2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_en.md +++ b/.github/ISSUE_TEMPLATE/bug_report_en.md @@ -4,21 +4,22 @@ about: Submit discovered bugs --- -### Involved route +- Involved route -### What is expected? +- What is expected -### What is actually happening? +- What is actually happening -### Self-deployed information +- Self-deployment information @@ -28,4 +29,4 @@ Please ensure you have deployed the [master branch](https://github.com/DIYgod/RS | Node version | | | if Docker, version | | -### Additional info (logs errors etc) +- Additional info (logs errors etc) diff --git a/.github/ISSUE_TEMPLATE/bug_report_zh.md b/.github/ISSUE_TEMPLATE/bug_report_zh.md index 942541d6e..9966c0c2b 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_zh.md +++ b/.github/ISSUE_TEMPLATE/bug_report_zh.md @@ -4,22 +4,23 @@ about: 早起的小可爱有虫抓 --- -### 路由地址 +- 路由地址 -### 预期是什么? +- 预期是什么 -### 实际发生了什么? +- 实际发生了什么 -### 部署相关信息 +- 部署相关信息 | Env | Value | @@ -28,4 +29,4 @@ about: 早起的小可爱有虫抓 | Node version | | | if Docker, version | | -### 额外信息(日志、报错等) +- 额外信息(日志、报错等) diff --git a/lib/middleware/onerror.js b/lib/middleware/onerror.js index 161a7c331..2c6cf39c8 100644 --- a/lib/middleware/onerror.js +++ b/lib/middleware/onerror.js @@ -22,6 +22,74 @@ module.exports = async (ctx, next) => { let message = err; if (err.name && (err.name === 'HTTPError' || err.name === 'RequestError')) { message = `${err.message}: target website might be blocking our access, you can host your own RSSHub instance for a better usability.`; + + const templateZh = ` + +- 路由地址 + \`${ctx.path}\` +- 预期是什么 + +- 实际发生了什么 + +- 部署相关信息 + + + +| Env | Value | +| ------------------ | ------------- | +| OS | | +| Node version |${process.version} | +| if Docker, version | | + +- 额外信息(日志、报错等) +\`\`\` + ${err.message} +\`\`\` `; + + const templateEn = ` + +- Involved route + \`${ctx.path}\` +- What is expected + +- What is actually happening + +- Self-deployment information + + + +| Env | Value | +| ------------------ | ------------- | +| OS | | +| Node version |${process.version} | +| if Docker, version | | + +- Additional info (logs errors etc) +\`\`\` + ${err.message} +\`\`\` `; + + message += `

如果您认为 RSSHub 导致了该错误,请在 GitHub 报告。`; + + message += `

If you believe this is an error caused by RSSHub, please report me on GitHub.`; } else if (err instanceof Error) { message = err.stack; }