News for hackers. Stuff that matters.
Re:A brief look at async-await by gbuk2013 on Monday December 09, 2019 @08:26AM (#21742370)
Yes this is true, as long as your error handling is the same for all calls (not necessarily the case, especially if logging is involved).

I don't actually have a problem with the callback version because it is nice and explicit. But again, I did originally say say that "async/await" was actually a valid use case in this necessarily serial scenario (and is exactly what I do in my article that I linked to). ;)

That said, if I see a chain of serial calls more than a few levels deep it is a code smell that indicates refactoring is necessary. There really is no reason to write code like that unless it's very simple logic. This is why I have never had a problem with "callback hell" even though I write code that is heavily asynchronous (APIs, WebSocket, pub/sub etc.)

There are no comments on this comment yet.