koajs / compose

Middleware composition utility
MIT License
1k stars 147 forks source link

Abnormal middleware errors occurred and KOA could not catch error events. How about the following changes #146

Open LmonZero opened 2 years ago

LmonZero commented 2 years ago

function compose (middleware) { if(!Array.isArray(middleware)) throw TypeError('Middleware stack must be an array!') for (const fn of middleware) { if(typeof fn !== 'function') throw new TypeError('Middleware must be composed of functions!') }

let index = -1 //

  /**

}