I ran into this odd case when I was attempting to use the PromiseProxyMixin
to clean up my templates. One of the situations was when I had a component that rendered a list after a search is completed with our API. The searching was debounced because it triggers when the search term changes. I then wrote a cancelation mechanism that would reject the last pending promise before making a new one this.set('promise', newPromise)
. I started noticing that these rejected promises were being spit out to our logging service because the Ember.onerror
were trapping all unhandled rejections even though the Component I had expected that.
Normally in a promise chain you can avoid unhandled errors by making sure you place a .catch()
at the end of the chain. However, I don't know how to do this if the promise is meant to be used in a PromiseProxyMixin
.
Here is a JSBin that illustrates the problem with expected rejections in a PromiseProxyMixin
.
Aucun commentaire:
Enregistrer un commentaire