mount icon indicating copy to clipboard operation
mount copied to clipboard

We can simple return next() without awaiting

Open nervgh opened this issue 8 years ago • 3 comments

It is one little simplification.

nervgh avatar Aug 20 '17 14:08 nervgh

this is true, but I try to avoid this as it affects try/catch behavior

jonathanong avatar Sep 11 '17 17:09 jonathanong

@jonathanong do you mean that it will break try/catch behavior?

For me that looks like "early exit":

// koa-mount
return async function (ctx, upstream) {
    // ...
    if (!newPath) return upstream()
// some middleware
async function (ctx, next) {
    return next()

Am I wrong?

nervgh avatar Sep 12 '17 05:09 nervgh

@jonathanong

Hi,

I think @nervgh 's idea is right, because the try/catch behavior has been handled in the koa-compose/index.js#L41

rdshoep avatar Sep 15 '17 02:09 rdshoep