DEV Community

Discussion on: Limit concurrent asynchronous calls

Collapse
 
benjaminblack profile image
Benjamin Black • Edited

No, because the function returns p itself, not the chained promise. The caller can attach its own .catch() clauses to p.

As in,

function foo() {
    let p = Promise.reject();

    p.catch(() => console.log('gotcha'));

    return p;
}


let p = foo();

p.catch(() => console.log('gotcha again'))