title: Retrofit 2 + Rxjava handling error
body: <p>So i already receive a token from the Json when the login is made without problems, and receive the hash</p>
  
  <p>But when the response from the server is a error, i cannot get the Json message ({message:"Error : wrong email} " because in the onError we only get as argument a Throwable and not a model class like in on</p>
  
  <p>how can i get a json message from server onError??</p>
  
  <pre><code>final Observable&lt;TokenResponse&gt; observable = Service.login(userCredentials);
      observable.subscribeOn(Schedulers.io())
              .observeOn(AndroidSchedulers.mainThread())
              .subscribe(new Subscriber&lt;TokenResponse&gt;() {
                  String error="";
  
                  @Override
                  public void onCompleted() {
                      mLoginView.whenLoginSucess();
                  }
  
                  @Override
                  public void onError(Throwable e) {
  
                      if (e instanceof HttpException) {
                          HttpException exception = (HttpException) e;
                          Response response = exception.response();
                          Converter&lt;ResponseBody, ErrorFromServer&gt; converter = new GsonConverterFactory()
                                  .responseBodyConverter(ErrorFromServer.class, Annotation[0]);
                          ErrorFromServer error = converter.convert(response.errorBody());
                      }
  
                      mLoginView.errorText(error);
  
                      e.printStackTrace();
  
                  }
  
                  @Override
                  public void onNext(TokenResponse tokenResponse) {
  
  
                      SharedPreferences.Editor editor = sharedP.edit();
                      editor.putString("hash", tokenResponse.getToken());
                      editor.commit();
  
                      //getString return key value "hash" if there is no value, returns null
                      hash = sharedP.getString("hash",null);
  
  
  
  
                  }
              });
  </code></pre>
  
  <p>TokenResponse code</p>
  
  <pre><code>public class TokenResponse {
  @SerializedName("hash")
  @Expose
  private String token;
  
  @SerializedName("message")
  @Expose
  private String message;
  
  
  public String getMessage() {return message;}
  
  
  public String getToken() {
      return token;
  }
  </code></pre>
  
  <p>}</p>