Skip to content

Commit

Permalink
Merge pull request #10 from jdev-org/develop
Browse files Browse the repository at this point in the history
add message when exception occurs
  • Loading branch information
pierrejego authored Sep 23, 2024
2 parents 6d45c75 + f83f9b7 commit 4b24d15
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private String authenticateToRemocra() throws APIConnectionException, APIAuthent
throw new IOException();
}
} catch (IOException e) {
logger.warn("Error : ", e);
// Impossible de contacter l'API
this.erreurRepository.addError(
"0003", "Impossible d'établir une connexion avec l'API Remocra", null);
Expand Down Expand Up @@ -131,6 +132,7 @@ public Integer sendRequest(String method, String path, String jsonData)
throw new RequestException(conn.getResponseCode(), errorCode, response);
}
} catch (IOException e) {
logger.warn("Error : ", e);
e.printStackTrace();
} finally {
if (conn != null) {
Expand Down Expand Up @@ -169,6 +171,8 @@ public String sendGetRequest(String path, Map<String, String> parameters)
}
}

logger.info("Send request to : " + path);

url = new URL(settings.host() + path);
conn = (HttpURLConnection) url.openConnection();

Expand All @@ -188,6 +192,7 @@ public String sendGetRequest(String path, Map<String, String> parameters)
content.append(inputLine);
}
in.close();
logger.debug("get response : " + content.toString());
return content.toString();
} else {
StringBuilder sb = new StringBuilder();
Expand All @@ -204,6 +209,7 @@ public String sendGetRequest(String path, Map<String, String> parameters)
throw new RequestException(conn.getResponseCode(), errorCode, response);
}
} catch (IOException e) {
logger.warn("Error : ", e);
e.printStackTrace();
} finally {
if (conn != null) {
Expand Down

0 comments on commit 4b24d15

Please sign in to comment.