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
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
var app = angular.module('plunker', []);
app.factory('$exceptionHandler', function(){
return function(exception, context){
console.log('$exceptionHandler caught', exception)
}
})
app.controller('MainCtrl', function($scope, $q) {
$scope.name = 'World';
var d = $q.defer();
d.reject(666);
var d2 = $q.defer();
d2.resolve(true);
d2.promise.then(function(){
throw new Error('thrown in then')
})
});
$exceptionHandler only gets the error that was thrown in the d2 chain, not the explicit rejection reason for d. I can't find documentation stating that this is or is not desired behavior, but such a case is captured in Bluebird promises, for example. It would also be cumbersome to have to add a .catch($exceptionHandler) on every single promise in one's project.
The text was updated successfully, but these errors were encountered:
I think this is related to #7992, which does appear to have been resolved yet.
From a quick read through it looks like what we want is for errors to be reported to $exceptionHandler only if there is no rejected handler registered for a promise chain. Is that right?
@caitp can you take a look and see if we can get to an acceptable solution. If it is agreed that such a solution is not a breaking change then it could get into a later 1.4.x release but it is not going to get into 1.4.0. Otherwise we can look to get it into 1.5.0
Possibly related to #7992 .
Given this app:
$exceptionHandler only gets the error that was thrown in the
d2
chain, not the explicit rejection reason ford
. I can't find documentation stating that this is or is not desired behavior, but such a case is captured in Bluebird promises, for example. It would also be cumbersome to have to add a.catch($exceptionHandler)
on every single promise in one's project.The text was updated successfully, but these errors were encountered: