mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-04 19:59:54 +08:00
feat: add error routes and error paths info
This commit is contained in:
@@ -10,5 +10,15 @@ module.exports = async (ctx, next) => {
|
||||
});
|
||||
ctx.body = `RSSHub 发生了一些意外: <pre>${err instanceof Error ? err.stack : err}</pre>`;
|
||||
ctx.status = 404;
|
||||
|
||||
if (!ctx.debug.errorPaths[ctx.request.path]) {
|
||||
ctx.debug.errorPaths[ctx.request.path] = 0;
|
||||
}
|
||||
ctx.debug.errorPaths[ctx.request.path]++;
|
||||
|
||||
if (!ctx.debug.errorRoutes[ctx._matchedRoute]) {
|
||||
ctx.debug.errorRoutes[ctx._matchedRoute] = 0;
|
||||
}
|
||||
ctx.debug.errorRoutes[ctx._matchedRoute]++;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user