When handlings errors with express I’ve noticed that sometimes we return the next call and sometimes we dont. Whats the difference and in wich cases do we need to use one or the other?
const err = Error('Invalid index!'); err.status = 404; next(err);
and sometimes it is written like this:
const err = new Error('Not enough beans in the jar to remove!'); err.status = 400; return next(err);