From 94c526925b18a88877a70b0df0ce962848cf5dd4 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Sun, 19 Feb 2012 22:57:08 +0200 Subject: [PATCH] better failure message on version conflict, its not the required version, its the provided version --- .../engine/VersionConflictEngineException.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/engine/VersionConflictEngineException.java b/src/main/java/org/elasticsearch/index/engine/VersionConflictEngineException.java index 286260e0d79..3ea11998c05 100644 --- a/src/main/java/org/elasticsearch/index/engine/VersionConflictEngineException.java +++ b/src/main/java/org/elasticsearch/index/engine/VersionConflictEngineException.java @@ -27,12 +27,26 @@ import org.elasticsearch.rest.RestStatus; */ public class VersionConflictEngineException extends EngineException { - public VersionConflictEngineException(ShardId shardId, String type, String id, long current, long required) { - super(shardId, "[" + type + "][" + id + "]: version conflict, current [" + current + "], required [" + required + "]"); + private final long current; + + private final long provided; + + public VersionConflictEngineException(ShardId shardId, String type, String id, long current, long provided) { + super(shardId, "[" + type + "][" + id + "]: version conflict, current [" + current + "], provided [" + provided + "]"); + this.current = current; + this.provided = provided; } @Override public RestStatus status() { return RestStatus.CONFLICT; } + + public long getCurrentVersion() { + return this.current; + } + + public long getProvidedVersion() { + return this.provided; + } }