title: Why my global error handler get invoked twice in my Angular app?
body: <p>I have this simple global error handler which stems from angular <code>ErrorHandler</code>. now regardless the location of the error, the initial handling is done twice, or at least this what it seems. my console logs the same error twice for the first time and as singles after that if the error persists, any reason why?</p>
  
  <pre><code>import { ErrorHandler, Injectable, Injector } from "@angular/core";
  import { Router } from '@angular/router';
  @Injectable()
  export class ArtCoreErrorHandler implements ErrorHandler {
  
    constructor(private injector: Injector) { }
  
    handleError(error) {
      console.log(error)
      const message = error.message ? error.message : error.toString();
      if (message == 'JWT must have 3 parts') {
        router.navigate(['/']).then(
          () =&gt; alert('wrong'),
        );
        location.reload();
      }
      throw error;
    }
  }
  </code></pre>
  
  <p>and in my <code>app module</code></p>
  
  <pre><code> providers: [
      {provide: ErrorHandler, useClass: ArtCoreErrorHandler},
      MDBSpinningPreloader,
  .........]
  </code></pre>