diff options
Diffstat (limited to 'src/deferred.js')
-rw-r--r-- | src/deferred.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/deferred.js b/src/deferred.js index ff12ac3e0..6a1ef3b43 100644 --- a/src/deferred.js +++ b/src/deferred.js @@ -157,12 +157,17 @@ jQuery.extend( { mightThrow(); } catch ( e ) { + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.stackTrace ); + } + // Support: Promises/A+ section 2.3.3.3.4.1 // https://promisesaplus.com/#point-61 // Ignore post-resolution exceptions if ( depth + 1 >= maxDepth ) { - // Only substitue handlers pass on context + // Only substitute handlers pass on context // and multiple values (non-spec behavior) if ( handler !== Thrower ) { that = undefined; @@ -182,6 +187,12 @@ jQuery.extend( { if ( depth ) { process(); } else { + + // Call an optional hook to record the stack, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getStackHook ) { + process.stackTrace = jQuery.Deferred.getStackHook(); + } window.setTimeout( process ); } }; |