add failure certainty to OmnipodException
This commit is contained in:
parent
0e8baedc8b
commit
8dcadd7a35
16 changed files with 78 additions and 4 deletions
|
@ -341,12 +341,14 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
// Shouldn't be reachable
|
||||
comment = getStringResource(R.string.omnipod_driver_error_unexpected_exception_type, ex.getClass().getName());
|
||||
}
|
||||
if (loggingEnabled()) {
|
||||
LOG.error(String.format("Caught OmnipodException[certainFailure=%s] from OmnipodManager (user-friendly error message: %s)", ((OmnipodException) ex).isCertainFailure(), comment), ex);
|
||||
}
|
||||
} else {
|
||||
comment = getStringResource(R.string.omnipod_driver_error_unexpected_exception_type, ex.getClass().getName());
|
||||
}
|
||||
|
||||
if (loggingEnabled()) {
|
||||
LOG.error(String.format("Caught OmnipodManager exception (user-friendly error message: %s)", comment), ex);
|
||||
LOG.error(String.format("Caught unexpected exception type from OmnipodManager (user-friendly error message: %s)", comment), ex);
|
||||
}
|
||||
}
|
||||
|
||||
return comment;
|
||||
|
|
|
@ -4,4 +4,9 @@ public class ActionInitializationException extends OmnipodException {
|
|||
public ActionInitializationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,9 @@ public class CommandInitializationException extends OmnipodException {
|
|||
public CommandInitializationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@ public class CommunicationException extends OmnipodException {
|
|||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
TIMEOUT("Communication timeout"),
|
||||
UNEXPECTED_EXCEPTION("Caught an unexpected Exception");
|
||||
|
|
|
@ -19,4 +19,9 @@ public class CrcMismatchException extends OmnipodException {
|
|||
public int getActual() {
|
||||
return actual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,9 @@ public class IllegalDeliveryStatusException extends OmnipodException {
|
|||
public DeliveryStatus getActual() {
|
||||
return actual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,9 @@ public class IllegalPacketTypeException extends OmnipodException {
|
|||
public PacketType getActual() {
|
||||
return actual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public class IllegalPodProgressException extends OmnipodException {
|
|||
public PodProgressStatus getActual() {
|
||||
return actual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,9 @@ public class IllegalResponseException extends OmnipodException {
|
|||
public MessageBlockType getExpectedType() {
|
||||
return expectedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public class IllegalSetupProgressException extends OmnipodException {
|
|||
public SetupProgress getActual() {
|
||||
return actual;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,9 @@ public class MessageDecodingException extends OmnipodException {
|
|||
public MessageDecodingException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,9 @@ public class NonceResyncException extends OmnipodException {
|
|||
public NonceResyncException() {
|
||||
super("Nonce resync failed");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,4 +13,9 @@ public class NotEnoughDataException extends OmnipodException {
|
|||
public byte[] getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,6 @@ public abstract class OmnipodException extends RuntimeException {
|
|||
public OmnipodException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public abstract boolean isCertainFailure();
|
||||
}
|
||||
|
|
|
@ -16,4 +16,9 @@ public class PodFaultException extends OmnipodException {
|
|||
public PodInfoFaultEvent getFaultEvent() {
|
||||
return faultEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,4 +13,9 @@ public class PodReturnedErrorResponseException extends OmnipodException {
|
|||
public ErrorResponse getErrorResponse() {
|
||||
return errorResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCertainFailure() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue