Skip to content

Commit 6150ab0

Browse files
committed
removed custom exception
1 parent 5e14aaa commit 6150ab0

File tree

6 files changed

+6
-36
lines changed

6 files changed

+6
-36
lines changed

modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/210_pipeline_processor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ teardown:
102102
- match: { acknowledged: true }
103103

104104
- do:
105-
catch: /ingest_cycle_exception/
105+
catch: /illegal_state_exception/
106106
index:
107107
index: test
108108
type: test
109109
id: 1
110110
pipeline: "outer"
111111
body: {}
112112
- match: { error.root_cause.0.type: "exception" }
113-
- match: { error.root_cause.0.reason: "java.lang.IllegalArgumentException: org.elasticsearch.ingest.IngestCycleException: Cycle detected for pipeline: inner" }
113+
- match: { error.root_cause.0.reason: "java.lang.IllegalArgumentException: java.lang.IllegalStateException: Cycle detected for pipeline: inner" }

modules/ingest-common/src/test/resources/rest-api-spec/test/ingest/90_simulate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ teardown:
668668
}
669669
- length: { docs: 1 }
670670
- length: { docs.0.processor_results: 1 }
671-
- match: { docs.0.processor_results.0.error.reason: "java.lang.IllegalArgumentException: org.elasticsearch.ingest.IngestCycleException: Cycle detected for pipeline: outer" }
671+
- match: { docs.0.processor_results.0.error.reason: "java.lang.IllegalArgumentException: java.lang.IllegalStateException: Cycle detected for pipeline: outer" }
672672
- match: { docs.0.processor_results.0.error.caused_by.caused_by.reason: "Cycle detected for pipeline: outer" }
673673

674674
---

server/src/main/java/org/elasticsearch/ingest/IngestCycleException.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

server/src/main/java/org/elasticsearch/ingest/IngestDocument.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,12 +643,11 @@ private static Object deepCopy(Object value) {
643643
* for this document.
644644
* @param pipeline Pipeline to execute
645645
* @throws Exception On exception in pipeline execution
646-
* @throws IngestCycleException If an cycle (infinite loops) are found between pipelines
647646
*/
648647
public IngestDocument executePipeline(Pipeline pipeline) throws Exception {
649648
try {
650649
if (this.executedPipelines.add(pipeline) == false) {
651-
throw new IngestCycleException("Cycle detected for pipeline: " + pipeline.getId());
650+
throw new IllegalStateException("Cycle detected for pipeline: " + pipeline.getId());
652651
}
653652
return pipeline.execute(this);
654653
} finally {

server/src/main/java/org/elasticsearch/ingest/TrackingResultProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public IngestDocument execute(IngestDocument ingestDocument) throws Exception {
6161
IngestDocument ingestDocumentCopy = new IngestDocument(ingestDocument);
6262
ingestDocumentCopy.executePipeline(pipelineProcessor.getPipeline());
6363
} catch (ElasticsearchException elasticsearchException) {
64-
if (elasticsearchException.getCause().getCause() instanceof IngestCycleException) {
64+
if (elasticsearchException.getCause().getCause() instanceof IllegalStateException) {
6565
throw elasticsearchException;
6666
}
6767
//else do nothing, let the tracking processors throw the exception while recording the path up to the failure

server/src/test/java/org/elasticsearch/ingest/TrackingResultProcessorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ public void testActualPipelineProcessorWithCycle() throws Exception {
459459

460460
ElasticsearchException exception = expectThrows(ElasticsearchException.class, () -> trackingProcessor.execute(ingestDocument));
461461
assertThat(exception.getCause(), instanceOf(IllegalArgumentException.class));
462-
assertThat(exception.getCause().getCause(), instanceOf(IngestCycleException.class));
462+
assertThat(exception.getCause().getCause(), instanceOf(IllegalStateException.class));
463463
assertThat(exception.getMessage(), containsString("Cycle detected for pipeline: pipeline1"));
464464
}
465465

0 commit comments

Comments
 (0)