jQuery.Deferred.getStackHook()


jQuery.Deferred.getStackHook()Returns: Errorversion deprecated: 3.7, removed: 4.0

Description: Return an Error instance with a defined stack.

Note: This API has been deprecated in jQuery 3.7; please use the jQuery.Deferred.getErrorHook method instead.

Note: This API is not defined by default, but jQuery will make use of it when defined.

See jQuery.Deferred.getErrorHook for the context why this API was created. Initially, we advised users to assign to it a function returning an error stack:

1
2
3
4
5
6
7
jQuery.Deferred.getStackHook = function() {
try {
throw new Error( "Exception in jQuery.Deferred" );
} catch ( err ) {
return err.stack; // stack property returned here
}
};

However, when such a stack is then logged by jQuery from inside of jQuery.Deferred.exceptionHook, the browser won't apply source maps. Therefore, we changed the recommendation to return the full error object itself. To make it clearer, the API was also renamed.