title: rxjs - How to retry after catching and processing an error with emitting something
body: <p>I'm using rxjs <code>v5.4.3</code>, redux-observable <code>v0.16.0</code>.</p>
  
  <p>in my application, I'd like to achieve below:</p>
  
  <ul>
  <li>an user has auth token, and refresh token to regenerate auth token.</li>
  <li>the user requests with auth token. (by emitting REQUEST action)</li>
  <li>if it failed, request regenerating auth token with refresh token.
  
  <ul>
  <li>if refreshed, emit TOKEN_REFRESHED action to update auth token, and do not emit REQUEST_FAILURE.</li>
  <li>if refreshing failed, emit REQUEST_FAILURE </li>
  </ul></li>
  <li>after refreshing(and updating auth token reducer), retry requesting using the refreshed auth token.
  
  <ul>
  <li>if request succeeded, emit REQUEST_SUCCESS, and if failed, emit REQUEST_FAILURE.</li>
  </ul></li>
  </ul>
  
  <p>I'd like to achieve like:</p>
  
  <pre><code>const fetchEpic = (action$: ActionsObservable&lt;Action&gt;, store: Store&lt;IRootState&gt;) =&gt; action$
    .ofAction(actions.fetchPost)
    .mergeMap(({ payload: { postId } })) =&gt; {
      const { authToken, refreshToken } = store.getState().auth;
  
      return api.fetchPost({ postId, authToken }) // this returns Observable&lt;ResponseJSON&gt;
        .map(res =&gt; actions.fetchSuccess({ res })) // if success, just emit success-action with the response
        .catch(err =&gt; {
          if (isAuthTokenExpiredError(err) {
            return api.reAuthenticate({ refreshToken })
              .map(res =&gt; actions.refreshTokenSuccess({ authToken: res.authToken });
              .catch(actions.fetchFailure({ err }))
              // and retry fetchPost after re-authenticate!
          }
  
          return Observable.of(actions.fetchFailure({ err }))
        })
    }
  </code></pre>
  
  <p>is there any solution?</p>