How to handle error in Retrofit 2.0
<p>I want to handle error in Retrofit 2.0</p>

<p>Got e.g. <code>code=404</code> and <code>body=null</code>, but <code>errorBody()</code> contains data in <code>ErrorModel</code> (<code>Boolean status</code> and <code>String info</code>).</p>

<p>This is <code>errorBody().content</code>: <code>[text=\n{"status":false,"info":"Provided email doesn't exist."}]</code>. </p>

<p>How can I get this data?</p>

<p>Thank for helping me!</p>

<p>This is my code for Retrofit request:</p>

<pre><code>ResetPasswordApi.Factory.getInstance().resetPassword(loginEditText.getText().toString())
    .enqueue(new Callback&lt;StatusInfoModel&gt;() {
        @Override
        public void onResponse(Call&lt;StatusInfoModel&gt; call, Response&lt;StatusInfoModel&gt; response) {
            if (response.isSuccessful()) {
                showToast(getApplicationContext(), getString(R.string.new_password_sent));
            } else {
                showToast(getApplicationContext(), getString(R.string.email_not_exist));
            }
        }

        @Override
        public void onFailure(Call&lt;StatusInfoModel&gt; call, Throwable t) {
            showToast(getApplicationContext(), "Something went wrong...");
        }
    });
</code></pre>