Question: I'm trying out the AndroidAsyncHttp library for Android downloaded from <http://loopj.com/android-async-http/> and am trying to find the best way to evaluate any connection errors within the onFailure(Throwable error, String response) callback. Ideally I'd like to see the HTTP status code returned e.g. 401,403,500 etc. Is there any way of doing this? So far I've only been able to get a string from error.getMessage() or error.toString().

Answer: 
In the end, managed to figure out all the different error scenarios just combinations of error.getMessage(), error.toString() and error.getCause()
```
import org.apache.http.client.HttpResponseException;

@Override
public void onFailure(Throwable e, String response) {
    if (e instanceof HttpResponseException) {
        HttpResponseException ex = (HttpResponseException) e;
        int statusCode = ex.getStatusCode();
    }
}

```