use of com.epam.pipeline.exception.PipelineResponseException in project cloud-pipeline by epam.
the class PipelineRunMapperOld method getRequestForRun.
private Optional<DocWriteRequest> getRequestForRun(final String indexName, final PipelineEvent event, final Map<String, PipelineUser> users) {
try {
PipelineRunWithLog run = cloudPipelineAPIClient.loadPipelineRunWithLogs(event.getObjectId());
PipelineUser pipelineUser = users.get(run.getPipelineRun().getOwner());
run.setRunOwner(pipelineUser);
return Optional.of(new IndexRequest(indexName, INDEX_TYPE, String.valueOf(run.getPipelineRun().getId())).source(pipelineRunToDocument(run)));
} catch (PipelineResponseException e) {
log.error(e.getMessage(), e);
if (isRunMissingError(event, e)) {
return Optional.of(createDeleteRequest(event, indexName));
}
return Optional.empty();
}
}
Aggregations