title: How to detect JavaScript errors during parsing phase on browser to show friendly error page?
body: <p>I have a React single page app.</p>
  
  <p>I use error boundaries to display a friendly error page when something goes wrong with my code.</p>
  
  <p>But this happened the other day.</p>
  
  <ul>
  <li>One of the packages I was requiring was not transpiled to ES5 and it contained an arrow function <code>() =&gt; {};</code></li>
  <li>When I tested on an old browser (Samsung Internet v4), which does not support arrow functions, it simply broke the code probably during the <code>parsing</code> phase, right?</li>
  <li>So my Error boundarie had no chance of capturing the error. And I basically rendered a blank page.</li>
  </ul>
  
  <p><strong>QUESTION</strong></p>
  
  <p>This error happened during the JS parsing, right?</p>
  
  <p>How can I detect that something went wrong during the parsing phase so I can render something useful, like: <code>Please update your ancient browser...</code></p>
  
  <p>Note: I have a <code>&lt;noscript&gt;</code> tag, but I guess that this is a different case.</p>