Skip to content

8.4.1 异常处理 纠正 #23

@InCodingNowLiu

Description

@InCodingNowLiu

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(); };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions