Skip to content

Commit

Permalink
fix: Derive QLDB exception, remove pointless messages
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Roberts <ryan@blockchaintp.com>
  • Loading branch information
ryan-s-roberts committed Jul 20, 2021
1 parent ae85b7d commit 4a98ab9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,22 @@
public class StoreException extends IOException {

/**
* An exception with cause and error message.
* An exception with an originating cause.
*
* @param error
* the error message
* @param cause
* the originating exception
* The cause.
*/
protected StoreException(final String error, final Throwable cause) {
super(error, cause);
public StoreException(final Throwable cause) {
super(cause);
}

/**
* An exception with an originating cause.
* A de novo exception originating in our code.
*
* @param cause
* the cause
* @param message
* An explanation of what happened.
*/
public StoreException(final Throwable cause) {
super(cause);
protected StoreException(final String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,6 @@
*/
public class StoreReadException extends StoreException {

/**
* Read exception with cause and error message.
*
* @param error
* the error message
* @param cause
* the originating exception
*/
public StoreReadException(final String error, final Throwable cause) {
super(error, cause);
}

/**
* A read exception with an originating cause.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@
* Represents a write failure of some sort to the store.
*/
public class StoreWriteException extends StoreException {

/**
* Write exception with cause and error message.
*
* @param error
* the error message
* @param cause
* the originating exception
*/
public StoreWriteException(final String error, final Throwable cause) {
super(error, cause);
}

/**
* A write exception with an originating cause.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public final Map<Key<K>, Value<V>> get(final List<Key<K>> listOfKeys) throws Sto
return map;

} catch (RuntimeException e) {
throw new StoreReadException("Exception while reading from store", e);
throw new StoreReadException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public Optional<Value<ByteString>> get(final Key<ByteString> key) throws StoreRe
}
return Optional.empty();
} catch (QldbDriverException e) {
throw new StoreReadException("Driver error", e);
throw new StoreReadException(e);
}
}

Expand Down Expand Up @@ -142,7 +142,7 @@ public Map<Key<ByteString>, Value<ByteString>> get(final List<Key<ByteString>> l
k -> Tuple.of(Key.of(ByteString.copyFrom(API.unchecked(() -> getIdFromRecord(k)).get().getBytes())),
Value.of(ByteString.copyFrom(API.unchecked(() -> getHashFromRecord(k)).get().getBytes()))));
} catch (QldbDriverException e) {
throw new StoreReadException("Driver", e);
throw new StoreReadException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,27 @@
*/
package com.blockchaintp.daml.stores.qldb;

import java.io.IOException;

import com.amazon.ion.IonValue;
import com.blockchaintp.daml.stores.exception.StoreException;

/**
* The detail of a QLDBStore exception, note this is not used to wrap S3 service issues, but purely
* for our own faults.
*/
public final class QldbStoreException extends IOException {
public final class QldbStoreException extends StoreException {
/**
* An exception with a message.
*
*
* @param message
* Pertinent message text.
*/
public QldbStoreException(final String message) {
protected QldbStoreException(final String message) {
super(message);
}

/**
* We have retrieved a qldb record with an unexpected schema.
*
*
* @param value
* @return The constructed exception
*/
Expand Down

0 comments on commit 4a98ab9

Please sign in to comment.