title: Angular 9: instance of error not working with custom error handler
body: <p>I am trying to implement custom error handling using the <code>ErrorHandler</code> class in angular</p>
  <p>My Globalerror service looks like this</p>
  <pre><code>export class CustomErrors extends Error {
    button?: any;
    errObject: any;
    constructor() {
      super('custom');
      Object.setPrototypeOf(this, CustomErrors.prototype);
    }
  }
  @Injectable()
  export class GlobalErrorHandler implements ErrorHandler {
    // constructor(private injector: Injector) {}
    constructor() {}
  
    handleError(error: any) {
     
      console.log('custom error', error instanceof CustomErrors);
  
     }
  }
  </code></pre>
  <p>In the component, I'm testing</p>
  <pre><code>ngOnInit() {
      try {
          throw new Error('error on do the thing');
      }
      catch (err) {
          const errs = new CustomErrors();
           //console.log('in service', errs instanceof CustomErrors);
            errs.button = 'Back to the start';
            throw err;
      }
  }
  </code></pre>
  <p>but the console message in the handlerror function <code> console.log('custom error', error instanceof CustomErrors);</code> always throws <code>false</code></p>
  <p>I am not sure why it's not getting true</p>