title: RxJS 6 - Cancel / End a Pipe
body: <p>Working with the new version of RxJS 6 and the pipe operator in particular. Currently using the pipe  to take the results of an API call and pass them to a series of additional tasks.</p>
  
  <p>All works great, but can't seem to find a way to cancel or end a pipe should I encounter an issue. For example, I'm using the tap operator to check if the value is null. I then throw an error, but the pipe still appears to move to the next task, in this case concatmap.</p>
  
  <p>Therefore, how do you end or cancel a pipe prematurely? Thanks in advance.</p>
  
  <pre class="lang-typescript prettyprint-override"><code>getData(id: String): Observable&lt;any[]&gt; {
  return this.http.get&lt;any&gt;(`${this.baseUrl}/path/${id}`).pipe(
     tap(evt =&gt; {
      if (evt == null) {
        return throwError(new Error("No data found..."));
      }
    }),
  concatMap(
    evt =&gt;
       &lt;Observable&lt;any[]&gt;&gt;(
          this.http.get&lt;any[]&gt;(
      `${this.baseUrl}/path/relatedby/${evt.child_id}`
        ).map(res =&gt;( {"response1":evt, "response2":res}) )
   )
  ),
  retry(3),
  catchError(this.handleError("getData", []))
  );}
  </code></pre>