Echo JS 0.11.0

<~>
tracker1 2497 days ago. link 1 point
While interesting, several of the examples don't account for errors, and are bad advice all around.  You're better off using async functions or explicitly using/returning proper promises, or at least account for error conditions.

Replies

davidchase 2497 days ago. link 1 point
Care to elaborate some more? The author shows how to account for errors in scenarios where there are potential errors for example a network request, so im not sure where you see it being bad advice overall, care to clarify your point?
tracker1 2497 days ago. link 1 point
const Foo = {
      async then (done) {
        done(await request('https://foo.com'))
      }
    }

What happens when request throws an error (or the promise rejects)? ... in this case, there's no value to it.
davidchase 2497 days ago. link 1 point
Ok, but he then proceeds to discuss exactly how to handle errors in the next section.
tracker1 2496 days ago. link 1 point
But even then, the error handling completely breaks thenable conventions, which is a second function passed to then.  In the end, Promises/thenables have a convention and this breaks it without providing more value than callbacks, while creating a context object construct.