7 ms·
I started programming professionally around the same time but I'm surprised that you think Promise.all([]) makes things easy. IMO Promise.all([]) is nice until
by sushid 9y ago
I started programming professionally around the same time but I'm surprised that you think Promise.all([]) makes things easy. IMO Promise.all([]) is nice until you start supporting proper error handling.
- nawgszy 9y agoI'm not sure what you're getting at, can you expand? I work a lot with databases, so say you're trying to write an object and its children in some sort of one-to-many relationship to the DB. You can write a Promise chain like startTransaction() .then(() => writeParent()) .then((children) => Promise.all(children.map((child) => writeChild(child) )) ) .then( // handle success endTransaction(), // handle error cancelTransaction() ) What exactly about that isn't "proper error handling"? Can you expand a bit on how this would be handled differently by you, or perhaps what paradigm you're programming in where Promise.all executes a bunch of items that can't all have the same success and error handler?