Mike 发表于 2021-7-16 20:30:32

error handling in Nodejs

If I simply throw the exception:
app.get('/error', (request, response) => {
throw new Error('Jerry oops')
});
Then:
Error: Jerry oops
at app.get (C:\Code\git\practice\nodejs\index.js:55:9)
at Layer.handle (C:\Code\git\practice\nodejs\node_modules\express\lib\router\layer.js:95:5)
at next (C:\Code\git\practice\nodejs\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (C:\Code\git\practice\nodejs\node_modules\express\lib\router\route.js:112:3)
at Layer.handle (C:\Code\git\practice\nodejs\node_modules\express\lib\router\layer.js:95:5)
at C:\Code\git\practice\nodejs\node_modules\express\lib\router\index.js:281:22
at Function.process_params (C:\Code\git\practice\nodejs\node_modules\express\lib\router\index.js:335:12)
at next (C:\Code\git\practice\nodejs\node_modules\express\lib\router\index.js:275:10)
at app.use (C:\Code\git\practice\nodejs\index.js:45:3)
at Layer.handle (C:\Code\git\practice\nodejs\node_modules\express\lib\router\layer.js:95:5)


文档来源:51CTO技术博客https://blog.51cto.com/jerrywangsap/3096616
页: [1]
查看完整版本: error handling in Nodejs