|
try { |
|
|
|
httpResp = execute(req.getUrl(), new UrlEncodedFormEntity(createNameValuePairs(req), StandardCharsets.UTF_8)); |
|
resp.setStatusCode(httpResp.getStatusLine().getStatusCode()); |
|
|
|
} catch (Exception e) { |
|
if (e instanceof UnknownHostException) { |
|
logger.warn("Couldn't connect to Google Analytics. Internet may not be available. " + e.toString()); |
|
} else { |
|
logger.warn("Exception while sending the Google Analytics tracker request " + req, e); |
|
} |
|
|
|
} finally { |
There is no way of knowing what happened if a post() fails. I think you should throw the error and let the caller deal with it. Other option is to set the Exception in a new field on the HttpResponse (which will always be empty in case of a failure).
Check:
google-analytics-java/src/main/java/com/brsanthu/googleanalytics/httpclient/ApacheHttpClientImpl.java
Lines 100 to 112 in 8ad1c1d
There is no way of knowing what happened if a
post()fails. I think you should throw the error and let the caller deal with it. Other option is to set theExceptionin a new field on theHttpResponse(which will always be empty in case of a failure).Check: