mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
improve error handling for paynym.is connection issues
This commit is contained in:
parent
3d13f596a0
commit
eb498f2bcc
3 changed files with 39 additions and 4 deletions
|
@ -31,7 +31,9 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.sparrowwallet.sparrow.AppServices.showErrorDialog;
|
||||||
import static com.sparrowwallet.sparrow.soroban.Soroban.TIMEOUT_MS;
|
import static com.sparrowwallet.sparrow.soroban.Soroban.TIMEOUT_MS;
|
||||||
|
|
||||||
public class CounterpartyController extends SorobanController {
|
public class CounterpartyController extends SorobanController {
|
||||||
|
@ -381,7 +383,12 @@ public class CounterpartyController extends SorobanController {
|
||||||
claimPayNym(soroban, createMap);
|
claimPayNym(soroban, createMap);
|
||||||
}, error -> {
|
}, error -> {
|
||||||
log.error("Error retrieving PayNym", error);
|
log.error("Error retrieving PayNym", error);
|
||||||
AppServices.showErrorDialog("Error retrieving PayNym", error.getMessage());
|
Optional<ButtonType> 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);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,14 @@ public class PayNymController extends SorobanController {
|
||||||
}, error -> {
|
}, error -> {
|
||||||
if(error.getMessage().endsWith("404")) {
|
if(error.getMessage().endsWith("404")) {
|
||||||
payNymName.setVisible(false);
|
payNymName.setVisible(false);
|
||||||
|
} else {
|
||||||
|
log.error("Error retrieving PayNym", error);
|
||||||
|
Optional<ButtonType> 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();
|
refresh();
|
||||||
}, error -> {
|
}, error -> {
|
||||||
log.error("Error retrieving PayNym", error);
|
log.error("Error retrieving PayNym", error);
|
||||||
AppServices.showErrorDialog("Error retrieving PayNym", error.getMessage());
|
Optional<ButtonType> 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();
|
refresh();
|
||||||
}, error -> {
|
}, error -> {
|
||||||
log.error("Could not follow payment code", error);
|
log.error("Could not follow payment code", error);
|
||||||
AppServices.showErrorDialog("Could not follow payment code", error.getMessage());
|
Optional<ButtonType> 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<ButtonType> 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();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,15 @@ public class SorobanController {
|
||||||
soroban.addSamouraiPaymentCode(newAuthToken, newSignature).subscribe(addMap -> {
|
soroban.addSamouraiPaymentCode(newAuthToken, newSignature).subscribe(addMap -> {
|
||||||
log.debug("Added payment code " + addMap);
|
log.debug("Added payment code " + addMap);
|
||||||
});
|
});
|
||||||
|
}, newError -> {
|
||||||
|
log.error("Error claiming PayNym with new authToken", newError);
|
||||||
});
|
});
|
||||||
}, newError -> {
|
}, newError -> {
|
||||||
log.error("Error claiming PayNym", newError);
|
log.error("Error retrieving new authToken", newError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}, error -> {
|
||||||
|
log.error("Error retrieving authToken", error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue