exceptionHook.js 830 B

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