title: Error: Uncaught (in promise): [object Object]
body: <pre><code>@Injectable()
  class MyErrorHandler implements ErrorHandler {
  
    handleError(error) {
      // exception occured in some service class method.
      console.log('Error in MyErrorhandler - %s', error);
        if(error == 'Something went wrong'){
         //do this.
       }else{
        //do this thing.
      }
    }
  }
  </code></pre>
  
  <p>When in some class' method throws an exception then, the MyErrorHandler class prints the error caught as <code>Error in MyErrorhandler - Error: Uncaught (in promise): [object Object]
  Error: Something went wrong.</code></p>
  
  <p><strong>Question1</strong>: Why does the error displays as <code>Error: Uncaught (in promise): [object Object]</code>?</p>
  
  <p><strong>Question2</strong>: Due to the above message it will always read the else part even in the case of <code>if(error == 'Something went wrong')</code>of the code in any condition.How can I resolve this?</p>