📅  最后修改于: 2022-03-11 14:48:36.456000             🧑  作者: Mango
import express, { NextFunction, ErrorRequestHandler } from 'express'
const app = express()
app.use(function(err, req, res, next: NextFunction) {
res.status(err.status ?? 500)
res.json({
success: false,
error: 'Internal error occured'
})
next(err)
})