Re: throw vs promise reject

On Mon, Sep 17, 2018 at 2:38 PM Guru Partap Khalsa
<> wrote:
> What is the reasoning for XMLHttpRequest to "throw" rather than rejecting a promise? It almost seems sarcastic to ask why a stack trace is helpful when the network times out.

Tangential to what Boris just said, note that all promises rejected by
the platform get rejected with an Error, so you still get a stack
trace either way. ^_^

(And this is the generally correct practice, as `await` turns a
rejection into a thrown error.)


Received on Thursday, 20 September 2018 18:46:00 UTC