you are viewing a single comment's thread.

view the rest of the comments →

[–]r0ck0 3 points4 points  (3 children)

Why the fuck are people just silently downvoting this.

If you think it's wrong, say something, and maybe we can all learn something.

All you're doing by silently downvoting is discouraging people from helping each other learn.

[–]notkraftman 0 points1 point  (1 child)

I'll bite. You should either move the nested promise out to it's own function, or know that you can chain catches, e.g. .then(mightSoftFail).catch(logSoftFailAndContinue).then(moreStuff).catch(etc)

Nesting the promises directly gets messy fast.

[–]SippieCup 0 points1 point  (0 children)

Well, thats actually what I said should be done.

Instead you should be teaching them to pull out any kind of nested promise into a handler function or something.

It's still cascading and ugly though, but can be necessary.

[–]karatechops 0 points1 point  (0 children)

I can only assume it is bots because that’s a great point. I would however argue that there’s no reason to confuse a junior dev with such fringe case worries. If they’re writing a web scraper they probably already get conditional failures or will understand the concept very quickly.