Skip to content

Commit

Permalink
Improved Browserstack diagnostic errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Dec 3, 2023
1 parent 8294226 commit 9104f79
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,16 @@ private String getSessionProperty(String propertyName) {
return null;
}

String sessionBody = null;
try {
HttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(RequestConfig.custom().
setCookieSpec(CookieSpecs.STANDARD).build()).build();
HttpGet querySessionInfo = new HttpGet(getSessionUri());
HttpEntity sessionDetails = httpClient.execute(querySessionInfo).getEntity();
String sessionBody = EntityUtils.toString(sessionDetails, charsetOf(sessionDetails));
sessionBody = EntityUtils.toString(sessionDetails, charsetOf(sessionDetails));
sessionElement = gson.fromJson(sessionBody, JsonElement.class);
} catch (IOException | JsonSyntaxException | JsonIOException e) {
LOGGER.error("Failed to connect to Browserstack API.", e);
LOGGER.error("Failed to connect to Browserstack API for session " + sessionId + System.lineSeparator() + sessionBody, e);
}

if (sessionElement == null) {
Expand Down

0 comments on commit 9104f79

Please sign in to comment.