mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix($q): call reject() even if $exceptionHandler rethrows
Normally $exceptionHandler doesn't throw an exception. It is normally used just for logging and so on. But if an application developer implemented a version that did throw an exception then $q would never have called reject() when converting an exception thrown inside a `then` handler into a rejected promise.
This commit is contained in:
committed by
Brian Ford
parent
c197c2aa27
commit
d59027c40e
@@ -215,8 +215,8 @@ function qFactory(nextTick, exceptionHandler) {
|
||||
try {
|
||||
result.resolve((callback || defaultCallback)(value));
|
||||
} catch(e) {
|
||||
exceptionHandler(e);
|
||||
result.reject(e);
|
||||
exceptionHandler(e);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -224,8 +224,8 @@ function qFactory(nextTick, exceptionHandler) {
|
||||
try {
|
||||
result.resolve((errback || defaultErrback)(reason));
|
||||
} catch(e) {
|
||||
exceptionHandler(e);
|
||||
result.reject(e);
|
||||
exceptionHandler(e);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user