Reputation: 14897
How do i configure jQuery to NOT trap errors? When i configure a button(ie: #btnTest) to call an event handler, it traps all exceptions and prevents them from displaying in the browser console. I need to know what exceptions are thrown for debugging purposes.
Example Code:
<input type='button' id='btnTest' value='Click me!'></input>
<script type='text/javascript'>
$("#btnTest").click(function() {
throw "AHHHHHHH! how do i get this message to show in the console?";
});
</script>
Upvotes: 0
Views: 265
Reputation: 144832
jQuery does not swallow exceptions. (There was a bug in versions 1.4.1 - 1.5.2 involving custom events fired on plain JS objects, but that wouldn't have an impact on your example.)
Here's a quick demo showing that jQuery will not swallow unhandled exceptions. Tested in Chrome and Firefox. If the exception does not make it to your console, there's something wrong with your configuration.
Upvotes: 1
Reputation: 26865
What do you mean with "browser console"?
If you are referring to Firebug console, you can do:
$("#btnTest").click(function() {
console.log("AHHHHHHH! how do i get this message to show in the console?");
});
(More info at: http://getfirebug.com/logging )
Also note that this will cause a Javascript error if Firebug is not loaded, so remember to remove any call to 'console' or alternatively use the "fake firebug console" technique to avoid errors when Firebug is not enabled: http://www.timrosenblatt.com/blog/2008/11/26/a-javascript-debugging-tip-for-firebug/.
Upvotes: 0