From 5b486c5b214ab762a95c76f4572f4c71b85d9e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BC=96=E7=A0=81=E7=8C=BF?= Date: Mon, 2 Dec 2024 09:55:42 +0800 Subject: [PATCH] 2222 --- app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app.js b/app.js index dbd958a..f87bd43 100644 --- a/app.js +++ b/app.js @@ -42,6 +42,16 @@ http.createServer(app).listen(config.port, "::",() => { `) }) +// error handler +app.use(function(err, req, res, next) { + console.log(` +程序出现错误 +status信息为:${err.status} +message信息为:${err.message} +error为:${err} +`) +}); + // app.listen(config.port, () => { // console.log(`