title: Logging client-side errors and "Script error"
body: <p>How do you pinpoint the client-side errors that occur in scripts from another domains?</p>
  
  <p>For clarity let's suppose that we have an average size web application that uses several scripts hosted by another domains (like google maps JS SDK).</p>
  
  <p>And one day you started receiving <code>Script error</code> in your error logs, which means there is a error occurred in a 3rd party code.</p>
  
  <p>But how would you find the exact method in your code that invoked a 3rd party code that eventually failed?</p>
  
  <p>PS: the error is not reproducible by developers and just occurs on the client machines quite rarely.</p>
  
  <p>PPS: For the errors above <code>window.onerror</code> <strong>DOES NOT</strong> provide call stack, proper error message, file name and line number. So it provides literally nothing helpful apart of <code>Script error</code> error message.</p>
  
  <p>PPPS:</p>
  
  <p>The third party script is included using <code>&lt;script src="http://..."&gt;&lt;/script&gt;</code> tags and executed using <code>someFunctionFromTheThirdPartyScript();</code></p>