diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java index 941c258c..46d76d15 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/CounterpartyController.java @@ -31,7 +31,9 @@ import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; +import java.util.Optional; +import static com.sparrowwallet.sparrow.AppServices.showErrorDialog; import static com.sparrowwallet.sparrow.soroban.Soroban.TIMEOUT_MS; public class CounterpartyController extends SorobanController { @@ -381,7 +383,12 @@ public class CounterpartyController extends SorobanController { claimPayNym(soroban, createMap); }, error -> { log.error("Error retrieving PayNym", error); - AppServices.showErrorDialog("Error retrieving PayNym", error.getMessage()); + Optional optResponse = showErrorDialog("Error retrieving PayNym", "Could not retrieve PayNym. Try again?", ButtonType.CANCEL, ButtonType.OK); + if(optResponse.isPresent() && optResponse.get().equals(ButtonType.OK)) { + retrievePayNym(null); + } else { + payNym.setVisible(false); + } }); } diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymController.java index 82766578..e77b659b 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/PayNymController.java @@ -159,6 +159,14 @@ public class PayNymController extends SorobanController { }, error -> { if(error.getMessage().endsWith("404")) { payNymName.setVisible(false); + } else { + log.error("Error retrieving PayNym", error); + Optional optResponse = showErrorDialog("Error retrieving PayNym", "Could not retrieve PayNym. Try again?", ButtonType.CANCEL, ButtonType.OK); + if(optResponse.isPresent() && optResponse.get().equals(ButtonType.OK)) { + refresh(); + } else { + payNymName.setVisible(false); + } } }); } @@ -290,7 +298,10 @@ public class PayNymController extends SorobanController { refresh(); }, error -> { log.error("Error retrieving PayNym", error); - AppServices.showErrorDialog("Error retrieving PayNym", error.getMessage()); + Optional optResponse = showErrorDialog("Error retrieving PayNym", "Could not retrieve PayNym. Try again?", ButtonType.CANCEL, ButtonType.OK); + if(optResponse.isPresent() && optResponse.get().equals(ButtonType.OK)) { + retrievePayNym(soroban); + } }); } @@ -301,8 +312,21 @@ public class PayNymController extends SorobanController { refresh(); }, error -> { log.error("Could not follow payment code", error); - AppServices.showErrorDialog("Could not follow payment code", error.getMessage()); + Optional optResponse = showErrorDialog("Error retrieving PayNym", "Could not follow payment code. Try again?", ButtonType.CANCEL, ButtonType.OK); + if(optResponse.isPresent() && optResponse.get().equals(ButtonType.OK)) { + followPayNym(soroban, contact); + } else { + followingList.refresh(); + } }); + }, error -> { + log.error("Could not follow payment code", error); + Optional optResponse = showErrorDialog("Error retrieving PayNym", "Could not follow payment code. Try again?", ButtonType.CANCEL, ButtonType.OK); + if(optResponse.isPresent() && optResponse.get().equals(ButtonType.OK)) { + followPayNym(soroban, contact); + } else { + followingList.refresh(); + } }); } diff --git a/src/main/java/com/sparrowwallet/sparrow/soroban/SorobanController.java b/src/main/java/com/sparrowwallet/sparrow/soroban/SorobanController.java index 0623040f..7fb44d47 100644 --- a/src/main/java/com/sparrowwallet/sparrow/soroban/SorobanController.java +++ b/src/main/java/com/sparrowwallet/sparrow/soroban/SorobanController.java @@ -40,11 +40,15 @@ public class SorobanController { soroban.addSamouraiPaymentCode(newAuthToken, newSignature).subscribe(addMap -> { log.debug("Added payment code " + addMap); }); + }, newError -> { + log.error("Error claiming PayNym with new authToken", newError); }); }, newError -> { - log.error("Error claiming PayNym", newError); + log.error("Error retrieving new authToken", newError); }); }); + }, error -> { + log.error("Error retrieving authToken", error); }); } }