|
|
|
|
|
by embwbam
4884 days ago
|
|
At least in node, you usually pass errors all the way back up the call chain. With normal callback style error handling, you have to put "if (err) return cb(err)" after each async call. It's crazy. With promises, you can attach an error handler once. If you think of errors as only unexpected conditions, you can have a single error handler for each set of operations and not have to worry about checking at each step. |
|
Or use a sane async library. As far as I can tell, something like https://github.com/caolan/async gives you a strict superset of Promise features, unless you're for some reason tied to how code with promises looks.