exceptionHook.js (830B)
1 define( [ 2 "../core", 3 "../deferred" 4 ], function( jQuery ) { 5 6 "use strict"; 7 8 // These usually indicate a programmer mistake during development, 9 // warn about them ASAP rather than swallowing them by default. 10 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 11 12 // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 13 // captured before the async barrier to get the original error cause 14 // which may otherwise be hidden. 15 jQuery.Deferred.exceptionHook = function( error, asyncError ) { 16 17 // Support: IE 8 - 9 only 18 // Console exists when dev tools are open, which can happen at any time 19 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 20 window.console.warn( "jQuery.Deferred exception: " + error.message, 21 error.stack, asyncError ); 22 } 23 }; 24 25 } );