diff --git a/lib/middleware/onerror.js b/lib/middleware/onerror.js index 6981be775..1bb5ae847 100644 --- a/lib/middleware/onerror.js +++ b/lib/middleware/onerror.js @@ -1,6 +1,8 @@ const logger = require('@/utils/logger'); const config = require('@/config'); const Sentry = require('@sentry/node'); +const art = require('art-template'); +const path = require('path'); if (config.sentry) { Sentry.init({ @@ -25,7 +27,9 @@ module.exports = async (ctx, next) => { ctx.set({ 'Content-Type': 'text/html; charset=UTF-8', }); - ctx.body = `Looks like something went wrong in RSSHub:
${message}
`; + ctx.body = art(path.resolve(__dirname, '../views/error.art'), { + message, + }); ctx.status = 404; if (!ctx.debug.errorPaths[ctx.request.path]) { diff --git a/lib/middleware/parameter.js b/lib/middleware/parameter.js index 3a2117a93..bf39b7010 100644 --- a/lib/middleware/parameter.js +++ b/lib/middleware/parameter.js @@ -12,7 +12,7 @@ module.exports = async (ctx, next) => { if (ctx.state.data) { if ((!ctx.state.data.item || ctx.state.data.item.length === 0) && !ctx.state.data.allowEmpty) { - throw Error('this route is empty, please check the original site or create an issue on https://github.com/DIYgod/RSSHub/issues/new/choose'); + throw Error('this route is empty, please check the original site or create an issue'); } if (ctx.query && ctx.query.mode && ctx.query.mode.toLowerCase() === 'fulltext') { diff --git a/lib/views/error.art b/lib/views/error.art new file mode 100644 index 000000000..187fc0498 --- /dev/null +++ b/lib/views/error.art @@ -0,0 +1,47 @@ + + + + + Error in RSSHub! + + + + +
+

+ RSSHub +

+ +

Looks like something went wrong

+ +
{{@ message }}
+ +

For online documentation and support please refer to + docs.rsshub.app.

+
+ + + diff --git a/lib/views/welcome.art b/lib/views/welcome.art index 13a9563ae..c4197b638 100644 --- a/lib/views/welcome.art +++ b/lib/views/welcome.art @@ -5,8 +5,6 @@ Welcome to RSSHub!