From 2890693f01e6ec37f88d6015c9b05bad5c0200a7 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Thu, 13 Sep 2018 15:02:18 -0400 Subject: [PATCH] Ensure we do not lose exceptions --- .../xpack/ccr/action/ShardChangesAction.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java index 6bc1f41b5ce49..e24086996b89f 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java @@ -314,10 +314,14 @@ protected void asyncShardOperation( if (g == UNASSIGNED_SEQ_NO) { assert e != null; if (e instanceof TimeoutException) { - final long mappingVersion = - clusterService.state().metaData().index(shardId.getIndex()).getMappingVersion(); - final SeqNoStats latestSeqNoStats = indexShard.seqNoStats(); - listener.onResponse(getResponse(mappingVersion, latestSeqNoStats, EMPTY_OPERATIONS_ARRAY)); + try { + final long mappingVersion = + clusterService.state().metaData().index(shardId.getIndex()).getMappingVersion(); + final SeqNoStats latestSeqNoStats = indexShard.seqNoStats(); + listener.onResponse(getResponse(mappingVersion, latestSeqNoStats, EMPTY_OPERATIONS_ARRAY)); + } catch (final Exception caught) { + listener.onFailure(caught); + } } else { listener.onFailure(e); }