window.onerror is not triggered when the console directly generates an error. It can be triggered via setTimeout
though, e.g., setTimeout(function() { notThere(); }, 0);
Possible duplicate: Chrome: Will an error in code invoked from the dev console trigger window.onerror?