title: Capturing JS errors in Chrome
body: <p>I'm capturing js errors in the application with <code>window.onerror</code>, but the thing is - in Chrome if dev tools isn't opened - then the <code>url</code> parameter passed to <code>onerror</code> handler always equals to the opened url.</p>
  
  <p>While if dev tools is opened - then the <code>url</code> points to the exact <code>.js</code> file the caused the js error.</p>
  
  <p>How do you deal with it? Are there any workarounds?</p>
  
  <p>And to be more clear - here are 2 results:</p>
  
  <ol>
  <li><code>Uncaught ReferenceError: a is not defined index:122</code> - this was received after fetching a page</li>
  <li><code>Uncaught ReferenceError: a is not defined List.js:122</code> - this was received after fetching the same page with dev tools opened. This is an expected result - I've put <code>a();</code> call to the <code>List.js</code> file for testing.</li>
  </ol>
  
  <p><strong>UPD</strong>: this is done for functional testing (using selenium webdriver) - I want to capture js errors for further investigations.</p>