aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/q.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ng/q.js')
-rw-r--r--src/ng/q.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ng/q.js b/src/ng/q.js
index cc39967c..6c4d3f5f 100644
--- a/src/ng/q.js
+++ b/src/ng/q.js
@@ -375,7 +375,12 @@ function qFactory(nextTick, exceptionHandler) {
then: function(callback, errback) {
var result = defer();
nextTick(function() {
- result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));
+ try {
+ result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));
+ } catch(e) {
+ result.reject(e);
+ exceptionHandler(e);
+ }
});
return result.promise;
}