You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Results with a .then are generally thought to be promises. The issue here is that the result isn't a real promise and doesn't conform the promises A+ spec.
This becomes a problem for example if you want to handle an exception you might assume that you can attach a .catch() to the result.
The text was updated successfully, but these errors were encountered:
When this was written, we tried to conform to the promises/A+ spec available here: https://promisesaplus.com/
There is nothing about .catch() in that spec, just onFullfilled and onRejected callback arguments to .then().
I do see that mozilla defines .catch() in their native Promise type. Will look into what it would take to implement this. Pull requests are also gratefully accepted :-)
I think it's the browser JS client that conforms a bit better to promises/A+.
I also don't see anything regarding .catch() in the spec, but I can at least enumerate a few places where this client is out-of-spec:
there is no onRejected - instead we always fulfill with a value that could contain a result or an error. This presumably makes it harder to compose effectively with other promise-wrapping libraries (async comes to mind)
we don't allow multiple callbacks, let alone a chainable interface or order guarantees
Results with a
.then
are generally thought to be promises. The issue here is that the result isn't a real promise and doesn't conform the promises A+ spec.This becomes a problem for example if you want to handle an exception you might assume that you can attach a
.catch()
to the result.The text was updated successfully, but these errors were encountered: