title: Angular/typescript - error object doesn't return complete stack information
body: <p>I'm trying to write an exception handler that will log the stack trace when an error is encountered. The error object doesn't return the stack correctly. The following snipped demonstrates the issue: </p>
  
  <pre><code>import { Component } from '@angular/core';
  
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  export class AppComponent {
    title = 'angular-error-stack';
  
    runTest() {
      try {
        let invalidJson = 'invalid json'; 
        let someObject = JSON.parse(invalidJson); 
      }
      catch(error) {
        console.log('----- error and error.stack are not the same! -----'); 
        console.log('------------------------------------------');
        console.log('Stack: ', error.stack); 
        console.log('------------------------------------------');
        console.log('Error', error); 
        console.log('------------------------------------------');
      }
    }
  }
  </code></pre>
  
  <p>When I run the above, I get different results. The console.log(error.stack) doesn't include the same information as console.log(error). </p>
  
  <p>console.log(error.stack) shows the error occurring at: </p>
  
  <pre><code>AppComponent.runTest (http://localhost:4220/main.js:102:35)
  </code></pre>
  
  <p>console.log(error) shows the error occurring at: </p>
  
  <pre><code>AppComponent.runTest (app.component.ts:14)
  </code></pre>
  
  <p>How can I get the correct stack trace? </p>
  
  <p>The snippet above produces the following output: </p>
  
  <blockquote>
    <p>Stack:  SyntaxError: Unexpected token i in JSON at position 0
        at JSON.parse ()
        at AppComponent.runTest (<a href="http://localhost:4220/main.js:102:35" rel="nofollow noreferrer">http://localhost:4220/main.js:102:35</a>)
        at Object.eval [as handleEvent] (ng:///AppModule/AppComponent.ngfactory.js:15:27)
        at handleEvent (<a href="http://localhost:4220/vendor.js:74619:122" rel="nofollow noreferrer">http://localhost:4220/vendor.js:74619:122</a>)
        at callWithDebugContext (<a href="http://localhost:4220/vendor.js:76238:27" rel="nofollow noreferrer">http://localhost:4220/vendor.js:76238:27</a>)
        at Object.debugHandleEvent [as handleEvent] (<a href="http://localhost:4220/vendor.js:75873:12" rel="nofollow noreferrer">http://localhost:4220/vendor.js:75873:12</a>)
        at dispatchEvent (<a href="http://localhost:4220/vendor.js:61706:25" rel="nofollow noreferrer">http://localhost:4220/vendor.js:61706:25</a>)
        at <a href="http://localhost:4220/vendor.js:73551:16" rel="nofollow noreferrer">http://localhost:4220/vendor.js:73551:16</a>
        at HTMLButtonElement. (<a href="http://localhost:4220/vendor.js:79297:38" rel="nofollow noreferrer">http://localhost:4220/vendor.js:79297:38</a>)
        at ZoneDelegate.invokeTask (<a href="http://localhost:4220/polyfills.js:3397:31" rel="nofollow noreferrer">http://localhost:4220/polyfills.js:3397:31</a>)</p>
    
    <p>Error:  SyntaxError: Unexpected token i in JSON at position 0
        at JSON.parse ()
        at AppComponent.runTest (app.component.ts:14)
        at Object.eval [as handleEvent] (AppComponent.html:3)
        at handleEvent (core.js:43992)
        at callWithDebugContext (core.js:45631)
        at Object.debugHandleEvent [as handleEvent] (core.js:45246)
        at dispatchEvent (core.js:29803)
        at core.js:42924
        at HTMLButtonElement. (platform-browser.js:2668)
        at ZoneDelegate.invokeTask (zone-evergreen.js:391)</p>
  </blockquote>