mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
15 lines
458 B
JavaScript
15 lines
458 B
JavaScript
const logger = require('@/utils/logger');
|
|
|
|
module.exports = async (ctx, next) => {
|
|
try {
|
|
await next();
|
|
} catch (err) {
|
|
logger.error(`Error in ${ctx.request.path}: ${err instanceof Error ? err.stack : err}`);
|
|
ctx.set({
|
|
'Content-Type': 'text/html; charset=UTF-8',
|
|
});
|
|
ctx.body = `RSSHub 发生了一些意外: <pre>${err instanceof Error ? err.stack : err}</pre>`;
|
|
ctx.status = 404;
|
|
}
|
|
};
|