Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.4.1 异常处理 纠正 #23

Open
InCodingNowLiu opened this issue Sep 4, 2020 · 0 comments
Open

8.4.1 异常处理 纠正 #23

InCodingNowLiu opened this issue Sep 4, 2020 · 0 comments

Comments

@InCodingNowLiu
Copy link

var handle = function (req, res, stack) { var next = function (err) { if (err) { return handle500(err, req, res, stack); } // 从stack数组中取出中间件并执行 var middleware = stack.shift(); if (middleware) { // 传入next()函数自身,使中间件能够执行结束后递归 try { middleware(req, res, next); } catch (ex) { **// 这里的ex 与 next参数中的err不匹配** next(err); } } }; // 启动执行 next(); };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant