title: How to catch error thrown by browser?
body: <p>In my case, I want to have a function that would be called on a different type of Error thrown by browser (RefferenceError, TypeError etc.).</p>
  
  <p>I've tried solution with <strong>window.onerror</strong> but that doesn't work.</p>
  
  <pre><code>window.onerror = function(message, file, line) { }
  </code></pre>
  
  <p>Maybe someone has any ideas how to solve that?
  Thanks</p>