Skip to content

Commit

Permalink
refactor(travisService): remove try-catch since e.getBodyAs() is no l…
Browse files Browse the repository at this point in the history
…onger called
  • Loading branch information
SheetalAtre committed Sep 12, 2023
1 parent 9f17d8b commit 131bd89
Showing 1 changed file with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,22 +446,15 @@ private Optional<String> getAndCacheJobLog(int jobId) {
}
} catch (SpinnakerServerException e) {
if (e instanceof SpinnakerHttpException) { // only SpinnakerHttpException has a response body
try {
Map<String, Object> body = ((SpinnakerHttpException) e).getResponseBody();
if (body != null && "log_expired".equals(body.get("error_type"))) {
log.info(
"{}: The log for job id {} has expired and the corresponding build was ignored",
groupKey,
jobId);
} else {
log.warn(
"{}: Could not get log for job id {}. Error from Travis:\n{}",
groupKey,
jobId,
body);
}
} catch (RuntimeException ex) {
log.warn("{}: Could not parse original error message from Travis", groupKey, ex);
Map<String, Object> body = ((SpinnakerHttpException) e).getResponseBody();
if (body != null && "log_expired".equals(body.get("error_type"))) {
log.info(
"{}: The log for job id {} has expired and the corresponding build was ignored",
groupKey,
jobId);
} else {
log.warn(
"{}: Could not get log for job id {}. Error from Travis:\n{}", groupKey, jobId, body);
}
}
}
Expand Down

0 comments on commit 131bd89

Please sign in to comment.