Skip to content

Commit

Permalink
no stack trace for known errors
Browse files Browse the repository at this point in the history
Signed-off-by: Maxwell Brown <[email protected]>
  • Loading branch information
Galactus22625 committed Jan 23, 2025
1 parent 7f769df commit 1618d8f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,19 @@ private <T> ResponseEntity<T> invokeRestApi(URI uri, Class<T> responseType) thro
} catch (HttpClientErrorException ex) {
HttpStatus statusCode = ex.getStatusCode();
String statusMessage = ex.getMessage();
log.error("An exception has occurred while getting response from Jira search API {}", ex.getMessage());
log.error("An exception has occurred while getting response from Jira search API with statusCode {} and error message {}.", statusCode, statusMessage);
if (statusCode == HttpStatus.FORBIDDEN) {
throw new UnAuthorizedException(statusMessage);
} else if (statusCode == HttpStatus.UNAUTHORIZED) {
log.error(NOISY, "Token expired. We will try to renew the tokens now", ex);
log.error(NOISY, "Token expired. We will try to renew the tokens now.");
authConfig.renewCredentials();
} else if (statusCode == HttpStatus.TOO_MANY_REQUESTS) {
log.error(NOISY, "Hitting API rate limit. Backing off with sleep timer.", ex);
log.error(NOISY, "Hitting API rate limit. Backing off with sleep timer.");
}
try {
Thread.sleep((long) RETRY_ATTEMPT_SLEEP_TIME.get(retryCount) * sleepTimeMultiplier);
} catch (InterruptedException e) {
throw new RuntimeException("Sleep in the retry attempt got interrupted", e);
throw new RuntimeException("Sleep in the retry attempt got interrupted.");
}
}
retryCount++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public String getJiraAccountCloudId() {
if (e.getRawStatusCode() == HttpStatus.UNAUTHORIZED.value()) {
renewCredentials();
}
log.error("Error occurred while accessing resources: ", e);
log.error("Error occurred while accessing resources. Status code: {}. Error message: {}", e.getStatusCode(), e.getMessage());
}
}
throw new UnAuthorizedException(String.format("Access token expired. Unable to renew even after %s attempts", RETRY_ATTEMPT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static InetAddress getInetAddress(String url) {
try {
return InetAddress.getByName(new URL(url).getHost());
} catch (UnknownHostException | MalformedURLException e) {
log.error(INVALID_URL, e);
log.error(INVALID_URL + " : {}", url);
throw new BadRequestException(e.getMessage(), e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public LeaderProgressState convertToPartitionState(final String serializedPartit
try {
return objectMapper.readValue(serializedPartitionProgressState, LeaderProgressState.class);
} catch (final JsonProcessingException e) {
LOG.error("Unable to convert string to partition progress state class ", e);
LOG.error("Unable to convert string to partition progress state class due to {}", e.getMessage());
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void run() {
try {
Thread.sleep(RETRY_BACKOFF_ON_EXCEPTION_MILLIS);
} catch (InterruptedException ex) {
log.warn("Thread interrupted while waiting to retry", ex);
log.warn("Thread interrupted while waiting to retry due to {}", ex.getMessage());
}
}
}
Expand Down

0 comments on commit 1618d8f

Please sign in to comment.