3 ms·
I don’t know why you assert that that’s where error handling should happen because I disagree. My thought was that promises were for values that are calculated
by hateduser2 9y ago
I don’t know why you assert that that’s where error handling should happen because I disagree. My thought was that promises were for values that are calculated asynchronously or anyways aren’t immediately available. They support errors but I don’t think this means that all code which emits errors should use promises to do error handling, that seems like a bastardization of the original idea.
- fleetfox 9y agoIt is calculated asynchronously. Response body is lazy and calling .json() on it consumes it and returns promise. That is API of WHATWG fetch and many other JS HTTP clients https://fetch.spec.whatwg.org/#body-mixin https://fetch.spec.whatwg.org/#body-mixin