<p dir="auto">I'm getting an issue where throwing an unhandled error turns into an infinite loop because the guarded callback wrapper fails to extract the error from the event:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/810438/23491589/152def8a-fef7-11e6-9719-266cc95639bd.png"><img width="468" alt="screen shot 2017-03-02 at 3 19 09 am" src="https://cloud.githubusercontent.com/assets/810438/23491589/152def8a-fef7-11e6-9719-266cc95639bd.png" style="max-width: 100%;"></a></p>
<p dir="auto">This causes the reconciler to ignore the error, thus triggering it again.</p>
<p dir="auto">To reproduce, I flipped <code class="notranslate">useSyncScheduling</code> to <code class="notranslate">false</code> in <code class="notranslate">ReactDOMFiber</code> (not sure if that was important), started <code class="notranslate">examples/real-world</code> from Redux and added a <code class="notranslate">throw</code> to its <code class="notranslate">User</code> component.</p>
<p dir="auto"><strong>Do you want to request a <em>feature</em> or report a <em>bug</em>?</strong><br>
Bug</p>
<p dir="auto"><strong>What is the current behavior?</strong><br>
When a component returns something other than a valid React element, or <code class="notranslate">null</code>, it throws and does so infinitely. This is render-blocking and freezes the window.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via <a href="https://jsfiddle.net" rel="nofollow">https://jsfiddle.net</a> or similar (template: <a href="https://jsfiddle.net/reactjs/69z2wepo/" rel="nofollow">https://jsfiddle.net/reactjs/69z2wepo/</a>).</strong><br>
This happened to me when creating a Provider-type component that rendered its children directly. More specifically, when they were <code class="notranslate">undefined</code>. Eg</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class Provider extends React.Component {
  render() {
    return this.props.children // should throw once.
  }
}

// Elsewhere
&lt;div&gt;
  &lt;Provider&gt;this works correctly&lt;/Provider&gt;

  // This freaks out
  &lt;Provider /&gt;
&lt;/div&gt;"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">Provider</span> <span class="pl-k">extends</span> <span class="pl-v">React</span><span class="pl-kos">.</span><span class="pl-c1">Component</span> <span class="pl-kos">{</span>
  <span class="pl-en">render</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">return</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">props</span><span class="pl-kos">.</span><span class="pl-c1">children</span> <span class="pl-c">// should throw once.</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-c">// Elsewhere</span>
<span class="pl-c1">&lt;</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span>
  <span class="pl-c1">&lt;</span><span class="pl-ent">Provider</span><span class="pl-c1">&gt;</span>this works correctly<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">Provider</span><span class="pl-c1">&gt;</span>

  // This freaks out
  <span class="pl-c1">&lt;</span><span class="pl-ent">Provider</span> <span class="pl-c1">/</span><span class="pl-c1">&gt;</span>
<span class="pl-c1">&lt;</span><span class="pl-c1">/</span><span class="pl-ent">div</span><span class="pl-c1">&gt;</span></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1608329/24016088/b7dbcac2-0a82-11e7-9493-a9e5d3877e40.png"><img width="1375" alt="screen shot 2017-03-16 at 15 29 54" src="https://cloud.githubusercontent.com/assets/1608329/24016088/b7dbcac2-0a82-11e7-9493-a9e5d3877e40.png" style="max-width: 100%;"></a></p>
<p dir="auto">Is there a [CodePen, Fiddle, etc] of <code class="notranslate">@next</code> somewhere, that I can use to demonstrate this?</p>
<p dir="auto"><strong>What is the expected behavior?</strong><br>
It should throw, but only once and not freeze the browser.</p>
<p dir="auto"><strong>Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?</strong><br>
React 16.0.0-alpha.4<br>
Yes, see <a href="http://codepen.io/rthor/pen/bqYBap?editors=0010#0" rel="nofollow">http://codepen.io/rthor/pen/bqYBap?editors=0010#0</a></p>
<hr>
<p dir="auto">PS I know it's an alpha version <g-emoji class="g-emoji" alias="smile" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png">😄</g-emoji></p>