Look for errors in the response data (JSON) and use those when throwing an exception before looking at the HTTP headers, because the JSON errors (if they exist) offer a lot more information than just "HTTP 400 Error".