Skip to content

Commit 666dc98

Browse files
committed
Show detailed error information in logs by using correct overload
1 parent 6a938c7 commit 666dc98

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/main/java/com/codedx/plugins/bamboo/CodeDxScanTaskConfigurator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,11 @@ private static List<Project> getProjectList(Map<String, Object> context) {
172172
try {
173173
return projectsApi.getProjects().getProjects();
174174

175-
} catch (IllegalArgumentException e) {
176-
_logger.error(e);
177-
} catch (ApiException e) {
178-
_logger.error(e);
175+
} catch (IllegalArgumentException | ApiException e) {
176+
_logger.error("Error while getting projects", e);
179177
} catch (ProcessingException e) {
180178
context.put("reachabilityMessage", "Connection refused. Please confirm that the URL is correct and that the Code Dx server is running.");
181-
_logger.error(e);
179+
_logger.error("Error while getting projects", e);
182180
}
183181

184182
return new ArrayList<Project>();

src/main/java/com/codedx/plugins/bamboo/ProjectRefresherServlet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
8282
projects = projectsApi.getProjects();
8383
} catch (ApiException e) {
8484

85-
_logger.error(e);
85+
_logger.error("Got an API error while listing projects", e);
8686

8787
// Bad API Token?
8888
int responseCode = e.getCode();
@@ -109,7 +109,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
109109
_logger.error("Error message to send to client: " + message);
110110
return;
111111
} catch (ProcessingException e) {
112-
_logger.error(e);
112+
_logger.error("Unexpected error while trying to fetch project list", e);
113113
resp.setStatus(404);
114114
resp.getOutputStream().print("Connection refused. Please confirm that the URL is correct and that the Code Dx server is running.");
115115
return;

src/main/java/com/codedx/plugins/bamboo/ServerConfigManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static ApiClient getConfiguredClient(String url, String apiKey, String fi
104104
.build();
105105
cdxApiClient.setHttpClient(client);
106106
} catch (Exception e) {
107-
_logger.error(e);
107+
_logger.error("Unexpected error configuring SSL", e);
108108
}
109109
}
110110
return cdxApiClient;

0 commit comments

Comments
 (0)