Provide clear error messages when no basal profile is active
This commit is contained in:
parent
e891f26be0
commit
0b75bbf85f
2 changed files with 18 additions and 3 deletions
|
@ -162,7 +162,14 @@ public class AapsOmnipodManager {
|
||||||
|
|
||||||
public PumpEnactResult setInitialBasalScheduleAndInsertCannula(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
public PumpEnactResult setInitialBasalScheduleAndInsertCannula(PodInitActionType podInitActionType, PodInitReceiver podInitReceiver, Profile profile) {
|
||||||
if (podInitActionType != PodInitActionType.FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP) {
|
if (podInitActionType != PodInitActionType.FILL_CANNULA_SET_BASAL_PROFILE_WIZARD_STEP) {
|
||||||
return new PumpEnactResult(injector).success(false).enacted(false).comment(getStringResource(R.string.omnipod_error_illegal_init_action_type, podInitActionType.name()));
|
String comment = getStringResource(R.string.omnipod_error_illegal_init_action_type, podInitActionType.name());
|
||||||
|
podInitReceiver.returnInitTaskStatus(podInitActionType, false, comment);
|
||||||
|
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||||
|
}
|
||||||
|
if (profile == null) {
|
||||||
|
String comment = getStringResource(R.string.omnipod_error_set_initial_basal_schedule_no_profile);
|
||||||
|
podInitReceiver.returnInitTaskStatus(podInitActionType, false, comment);
|
||||||
|
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -233,6 +240,12 @@ public class AapsOmnipodManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PumpEnactResult setBasalProfile(Profile profile) {
|
public PumpEnactResult setBasalProfile(Profile profile) {
|
||||||
|
if (profile == null) {
|
||||||
|
String comment = getStringResource(R.string.omnipod_error_failed_to_set_profile_empty_profile);
|
||||||
|
showNotification(Notification.FAILED_UDPATE_PROFILE, comment, Notification.URGENT, R.raw.boluserror);
|
||||||
|
return new PumpEnactResult(injector).success(false).enacted(false).comment(comment);
|
||||||
|
}
|
||||||
|
|
||||||
PodHistoryEntryType historyEntryType = podStateManager.isSuspended() ? PodHistoryEntryType.RESUME_DELIVERY : PodHistoryEntryType.SET_BASAL_SCHEDULE;
|
PodHistoryEntryType historyEntryType = podStateManager.isSuspended() ? PodHistoryEntryType.RESUME_DELIVERY : PodHistoryEntryType.SET_BASAL_SCHEDULE;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -761,7 +774,7 @@ public class AapsOmnipodManager {
|
||||||
}
|
}
|
||||||
aapsLogger.error(LTag.PUMP, String.format("Caught OmnipodException[certainFailure=%s] from OmnipodManager (user-friendly error message: %s)", ((OmnipodException) ex).isCertainFailure(), comment), ex);
|
aapsLogger.error(LTag.PUMP, String.format("Caught OmnipodException[certainFailure=%s] from OmnipodManager (user-friendly error message: %s)", ((OmnipodException) ex).isCertainFailure(), comment), ex);
|
||||||
} else {
|
} else {
|
||||||
comment = getStringResource(R.string.omnipod_driver_error_unexpected_exception_type, ex.getClass().getName());
|
comment = getStringResource(R.string.omnipod_driver_error_unexpected_exception_type, ex.getClass().getName(), ex.getMessage());
|
||||||
aapsLogger.error(LTag.PUMP, String.format("Caught unexpected exception type[certainFailure=false] from OmnipodManager (user-friendly error message: %s)", comment), ex);
|
aapsLogger.error(LTag.PUMP, String.format("Caught unexpected exception type[certainFailure=false] from OmnipodManager (user-friendly error message: %s)", comment), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
<string name="omnipod_error_illegal_init_action_type">Illegal PodInitActionType: %1$s</string>
|
<string name="omnipod_error_illegal_init_action_type">Illegal PodInitActionType: %1$s</string>
|
||||||
<string name="omnipod_error_pod_not_attached">No active Pod</string>
|
<string name="omnipod_error_pod_not_attached">No active Pod</string>
|
||||||
<string name="omnipod_driver_error_setup_action_verification_failed">Command verification failed</string>
|
<string name="omnipod_driver_error_setup_action_verification_failed">Command verification failed</string>
|
||||||
<string name="omnipod_driver_error_unexpected_exception_type">An unexpected error occurred. Please report! (type: %1$s).</string>
|
<string name="omnipod_driver_error_unexpected_exception_type">An unexpected error occurred. Please report! (%1$s: %2$s).</string>
|
||||||
<string name="omnipod_driver_error_invalid_parameters">Communication failed: received invalid input parameters</string>
|
<string name="omnipod_driver_error_invalid_parameters">Communication failed: received invalid input parameters</string>
|
||||||
<string name="omnipod_driver_error_communication_failed_timeout">Communication failed: timeout</string>
|
<string name="omnipod_driver_error_communication_failed_timeout">Communication failed: timeout</string>
|
||||||
<string name="omnipod_driver_error_communication_failed_unexpected_exception">Communication failed: an unexpected error occurred. Please report!</string>
|
<string name="omnipod_driver_error_communication_failed_unexpected_exception">Communication failed: an unexpected error occurred. Please report!</string>
|
||||||
|
@ -190,6 +190,8 @@
|
||||||
<string name="omnipod_history_item_source">Source</string>
|
<string name="omnipod_history_item_source">Source</string>
|
||||||
<string name="omnipod_history_item_date">Date</string>
|
<string name="omnipod_history_item_date">Date</string>
|
||||||
<string name="omnipod_history_type">Type:</string>
|
<string name="omnipod_history_type">Type:</string>
|
||||||
|
<string name="omnipod_error_failed_to_set_profile_empty_profile">Failed to set basal profile: received an empty profile. Make sure to activate your basal profile.</string>
|
||||||
|
<string name="omnipod_error_set_initial_basal_schedule_no_profile">No basal profile is active. Make sure to activate your basal profile.</string>
|
||||||
|
|
||||||
<plurals name="omnipod_minutes">
|
<plurals name="omnipod_minutes">
|
||||||
<item quantity="one">%1$d minute</item>
|
<item quantity="one">%1$d minute</item>
|
||||||
|
|
Loading…
Reference in a new issue