title: How to return custom error in Angular service?
body: <p>I have a service that will return http query, my caller will by default receive the result and assign it to a News[] object.</p>
  
  <pre><code> this.service.getNews(url).subscribe((res) =&gt; this.news = res);
  </code></pre>
  
  <p>now I want to throw a custom error if any error occured:</p>
  
  <pre><code>getNews(url:string): Observable&lt;News[]&gt; {
    return this.http.get&lt;News[]&gt;(url).catch(err =&gt; {
    throw new Error("My Custom Error");
  });
  </code></pre>
  
  <p>But I got a compling error that "cannot assign the {} to a Observable &lt; News[] >"  because the error is not a type of News[].</p>
  
  <p>So how can I modify the code to return an error without changing the returning type Observable &lt; News[] >?</p>