You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

14 lines
452 B

const logger = require('../utils/logger');
module.exports = async (ctx, next) => {
try {
await next();
} catch (err) {
logger.error('Promise error: ' + (err instanceof Error ? err.stack : err));
ctx.set({
'Content-Type': 'text/html; charset=UTF-8',
});
ctx.body = `DPlayer-node 发生了一些意外: <pre>${err instanceof Error ? err.stack : err}</pre>`;
ctx.status = 500;
}
};