diff options
Diffstat (limited to 'src/main/java')
3 files changed, 19 insertions, 4 deletions
diff --git a/src/main/java/com/amazon/carbonado/UnsupportedTypeException.java b/src/main/java/com/amazon/carbonado/UnsupportedTypeException.java index fcc576c..7adcdec 100644 --- a/src/main/java/com/amazon/carbonado/UnsupportedTypeException.java +++ b/src/main/java/com/amazon/carbonado/UnsupportedTypeException.java @@ -29,12 +29,27 @@ public class UnsupportedTypeException extends SupportException { private final Class<? extends Storable> mType;
- public UnsupportedTypeException(Class<? extends Storable> type) {
- super("Independent type not supported: " + type.getName());
+ public UnsupportedTypeException(String message, Class<? extends Storable> type) {
+ super(message);
mType = type;
}
public Class<? extends Storable> getType() {
return mType;
}
+
+ @Override
+ public String getMessage() {
+ String message = super.getMessage();
+
+ if (mType != null) {
+ if (message == null) {
+ message = mType.getName();
+ } else {
+ message = message + ": " + mType.getName();
+ }
+ }
+
+ return message;
+ }
}
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java index f9c6d25..522bb2d 100644 --- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCRepository.java @@ -212,7 +212,7 @@ public class JDBCRepository synchronized (mAllTxnMgrs) {
JDBCStorableInfo<S> info = examineStorable(type);
if (!info.isSupported()) {
- throw new UnsupportedTypeException(type);
+ throw new UnsupportedTypeException("Independent type not supported", type);
}
return new JDBCStorage<S>(JDBCRepository.this, info);
}
diff --git a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java index 11c11b6..5edc42c 100644 --- a/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java +++ b/src/main/java/com/amazon/carbonado/repo/replicated/ReplicatedRepository.java @@ -360,7 +360,7 @@ class ReplicatedRepository if (storageFor(type) instanceof ReplicatedStorage) {
trigger = ((ReplicatedStorage) storageFor(type)).getTrigger();
} else {
- throw new UnsupportedTypeException(type);
+ throw new UnsupportedTypeException("Storable type is not replicated", type);
}
Storage<S> replicaStorage, masterStorage;
|