summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2006-11-10 21:29:50 +0000
committerBrian S. O'Neill <bronee@gmail.com>2006-11-10 21:29:50 +0000
commit5b71d4680b058f7ea310ee878df2435e3bc70703 (patch)
treee4c8f84dad502d68e764ee17cb4a3399b9af81d3
parent76b4a47be06da41b791480504b7cd65c2f05fe57 (diff)
Improve exception message.
-rw-r--r--src/main/java/com/amazon/carbonado/OptimisticLockException.java14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/main/java/com/amazon/carbonado/OptimisticLockException.java b/src/main/java/com/amazon/carbonado/OptimisticLockException.java
index b4a43de..949537e 100644
--- a/src/main/java/com/amazon/carbonado/OptimisticLockException.java
+++ b/src/main/java/com/amazon/carbonado/OptimisticLockException.java
@@ -72,16 +72,10 @@ public class OptimisticLockException extends PersistException {
}
private static String makeMessage(Object expectedVersion, Object savedVersion) {
- if (expectedVersion == null) {
- if (savedVersion == null) {
- return null;
- }
- return "Failed to update because saved version is " + savedVersion;
+ if (expectedVersion == null && savedVersion == null) {
+ return null;
}
- if (savedVersion == null) {
- return "Failed to update for expected version " + expectedVersion;
- }
- return "Failed to update for expected version " + expectedVersion +
- " because saved version is " + savedVersion;
+ return "Update acted on version " + expectedVersion +
+ ", but canonical version is " + savedVersion;
}
}