title: Handling retryWhen status code in RxJS 5.5
body: <p>I have some code I'm migrating to RxJS 5.5, which already worked.</p>
  
  <pre><code>public getMentor(id: number): Observable&lt;Employee&gt; {
      const url = `${this.employeeUrl}/${id}/mentor`;
      return this.http
          .get(url, this.authService.getOptionsWithToken())
          .retryWhen(errors =&gt; {
              return errors
                  .mergeMap(error =&gt; (error.status === 404) ? Observable.throw(error) : Observable.of(error))
                  .take(this.maxRetries);
          })
          .map(response =&gt; response.json() as Employee)
          .catch(ErrorHandlerService.handleError);
  }
  </code></pre>
  
  <p>In any case, if this request fails with 404, it's OK according to the business logic. Now, this would be a near equivalent in 5.5:</p>
  
  <pre><code>public getMentor(id: number): Observable&lt;Employee&gt; {
    const url = `${this.employeeUrl}/${id}/mentor`;
    return this.http.get&lt;Employee&gt;(url)
      .pipe(
        retryWhen(errors =&gt; {
          console.log('errorInService', errors);
          return errors.pipe(
            mergeMap(error =&gt; (error.status === 404) ? _throw(error) : of(error)),
            take(this.maxRetries)
          )
        }),
        catchError(ErrorHandlerService.handleError)
      );
  }
  </code></pre>
  
  <p>Here, the flow gets interrupted because inside retryWhen, errors is now a Subject and I cannot extract the status as before.</p>
  
  <pre><code>this.employeeService.getMentor(this.mentee.id).subscribe(
      mentor =&gt; {
        this.existingMentor = mentor;
        this.modalAddConfirmation(addConfirmation, mentee, form);
      },
      e =&gt; {
        console.log('errorInMentor', e);
        if (e.status === 404) {
          // console.log('No mentor');
          this.employeeService.putMentor(mentee.id, this.mentor)
            .subscribe(() =&gt; this.mentees.push(mentee));
        } else {
          return null;
        }
      }
    );
  </code></pre>
  
  <p>In the original caller, "e" is now a string which says <code>Http failure response for http://localhost:8888/employees/1/mentor: 404 OK</code> instead of an object. Obviously, the <code>putMentor()</code> call never gets made. I'm just learning so it's most likely I haven't understood fully the new pipeable operators.</p>
  
  <h2>Update</h2>
  
  <p>At least this code is throwing an ErrorObservable, but on the caller end (<code>errorInMentor</code>) it's still a string:</p>
  
  <pre><code>public getMentor(id: number): Observable&lt;Employee&gt; {
    const url = `${this.employeeUrl}/${id}/mentor`;
    return this.http.get&lt;Employee&gt;(url)
      .pipe(
        retryWhen(errors =&gt; {
          return errors.pipe(
            mergeMap(error =&gt; {
              console.log('error MergeMap', error);
              return error.status === 404 ? _throw(error) : of(error);
            }),
            take(this.maxRetries)
          )
        }),
        catchError(ErrorHandlerService.handleError)
      );
  }
  </code></pre>