mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-04 19:59:54 +08:00
feat: replace text
This commit is contained in:
@@ -15,19 +15,17 @@ module.exports = async (ctx, next) => {
|
||||
try {
|
||||
await next();
|
||||
} catch (err) {
|
||||
let message;
|
||||
let message = err;
|
||||
if (err.name && (err.name === 'HTTPError' || err.name === 'RequestError')) {
|
||||
message = `${err.message}: target website might be blocking our access, you can <a href="https://docs.rsshub.app/install/">host your own RSSHub instance</a> for a better usability.`;
|
||||
} else if (err instanceof Error) {
|
||||
message = err.stack;
|
||||
} else {
|
||||
message = err;
|
||||
}
|
||||
logger.error(`Error in ${ctx.request.path}: ${message}`);
|
||||
ctx.set({
|
||||
'Content-Type': 'text/html; charset=UTF-8',
|
||||
});
|
||||
ctx.body = `RSSHub 发生了一些意外: <pre>${message}</pre>`;
|
||||
ctx.body = `Looks like something went wrong in RSSHub: <pre>${message}</pre>`;
|
||||
ctx.status = 404;
|
||||
|
||||
if (!ctx.debug.errorPaths[ctx.request.path]) {
|
||||
|
||||
Reference in New Issue
Block a user