Apache HttpClient docs for the method execute(HttpHost target, HttpRequest request)say:
execute(HttpHost target, HttpRequest request)
IOException - in case of a problem or the connection was interrupted
If I catch an IOException, will it catch ALL 5xx Server Errors ?
try { response = client.execute(httpHost, request); } catch (IOException e) { // throw custom Exception } finally { // close response and client }
The reason I ask is because after this logic somewhere else down the line we do something like the following:
if (response.getStatusLine().getStatusCode() >= 500) { // Could we ever reach this point after the code above? }
No, HttpClient will not throw an IO exception for any 500 / 5xx response .
IOException (, , ) TCP-, (, ).
"HTTP 500" - - - . , , 200.
, "[] "; , .
Source: https://habr.com/ru/post/1606224/More articles:Get table contents in BeautifulSoup - pythonSpring MVC @ModelAttribute Method Returns Bad Request 400 - javaHow to have multiple assembly assemblies with glass? - haskellДва выпадающих списка с одним - javascriptGIT clone issue in Jenkins resolution - gitHow to change git tracking submodules of a remote branch? - gitPrevent popping at the end of a sound in Pygame.mixer - pythonВ чем разница и взаимосвязь между "xx-softmmu" и "xx-linux-user"? - qemuCheck chrome.storage.sync while debugging the Chrome extension. - javascriptExpress check Paypal vs REST api? - paypalAll Articles