} catch (CannotConnectException e) {
LOG.error("Error while sending delete resource request to agent service", e);
// Submit the error as a failure response
String errorMessage = ThrowableUtil.getAllMessages(e);
DeleteResourceResponse response = new DeleteResourceResponse(persistedHistory.getId(),
DeleteResourceStatus.FAILURE, errorMessage);
resourceFactoryManager.completeDeleteResourceRequest(response);
throw new CannotConnectToAgentException("Error while sending delete resource request to agent service", e);
} catch (Exception e) {
LOG.error("Error while sending delete resource request to agent service", e);
// Submit the error as a failure response
String errorMessage = ThrowableUtil.getAllMessages(e);
DeleteResourceResponse response = new DeleteResourceResponse(persistedHistory.getId(),
DeleteResourceStatus.FAILURE, errorMessage);
resourceFactoryManager.completeDeleteResourceRequest(response);
throw new RuntimeException("Error while sending delete resource request to agent service", e);
}