title: How can I log an error as if it was uncaught?
body: <p>I have a complex JavaScript application where when certain unexpected errors occur, I want to log them for debugging but continue.</p>
  
  <p>How do I log them to the console <strong>so that their stack is accessible in the normal fashion for an uncaught error?</strong></p>
  
  <p>A uncaught error in the Chrome console normally shows only the error message, and has a disclosure triangle which can be clicked to show the stack trace. This (and any other debugging features Chrome has now or might add in the future for uncaught errors) is what I want.</p>
  
  <p>If I do the obvious <code>catch (e) { console.log(e); }</code> or <code>console.error(e)</code>, the error object is instead shown in object-inspector fashion — there is a triangle but clicking it shows the <em>properties of the error object</em> (so I have to click four more times to get the stack property in a poorly-formatted way). I could log <code>e.stack</code>, but that's still missing some standard features.</p>
  
  <p><code>setTimeout(function () { throw e; }, 0);</code> is another option, but confuses debugging because it changes the ordering of messages in the console. (Putting the entire code-which-might-throw in a setTimeout <em>might</em> be feasible, but I want to investigate just fixing the logging first.)</p>