angular-cache
angular-cache copied to clipboard
Unhandled promise rejection hidden within library
Since Angular 1.6, unhandled promise rejections are sent to the exceptionHandler. In cases where you don't want a rejected promise to be treated as an exception, you must handle the rejection with a .catch.
In angular-cache there is a getHandler function that contains the following line "return utils.Promise.reject(v);" This creates a promise and rejects it. However, this promise is not exposed, in any way, outside of the library and so you cannot handle it with a .catch.
As a consequence, if you are are using angular-cache to cache $http requests, even if you handle the rejection of the $http promise itself, you will still get a "Possibly Unhandled Rejection" error sent to the exceptionHandler because of this internal, rejected promise.
+1 This has been for a while now (at least since January).
For anyone getting here for a workaround: https://docs.angularjs.org/api/ng/provider/$qProvider
Hey, any solution for this yet?