title: How to create an interceptor for errors to make another call?
body: <p>I'm getting a 401, because token has expired, so I need to renew the token with another call and then do the call again, is there an easy way instead of doing : </p>
  
  <pre><code>disposable = loginService.login(
                  UserToLoginRequest(
                      input_email_login.text.toString(),
                      input_password_login.text.toString(),
                      generateRandomDeviceInfo()
                  )
              )
                  .subscribeOn(Schedulers.io())
                  .observeOn(AndroidSchedulers.mainThread())
                  .subscribe(
                      { result -&gt;
                          //It works
                      },
                      { error -&gt; if(error.code == 401) renewAccessToken() }
                  )
  </code></pre>
  
  <p>The thing is that I want to do something like this guy : <a href="https://stackoverflow.com/questions/22450036/refreshing-oauth-token-using-retrofit-without-modifying-all-calls">Refreshing Oath token</a>, but if it's possible to call again the same endpoint with the same parameters.</p>
  
  <h2>Example</h2>
  
  <p><code>getApple(1)</code> &lt;-- return info of apple id 1</p>
  
  <p>The result is 401 &lt;-- can't do the call without refreshing the accessToken    <code>refreshAccessToken()</code> </p>
  
  <p>Automatically call <code>getApple(1)</code> without disturbing the user</p>