remove global error handler for taking offer

This commit is contained in:
woodser 2023-12-29 09:11:36 -05:00
parent fdb24ba9f8
commit 342c212ba8
5 changed files with 1 additions and 17 deletions

View File

@ -93,7 +93,6 @@ public class HavenoHeadlessApp implements HeadlessApp {
lastVersion, Version.VERSION)); lastVersion, Version.VERSION));
havenoSetup.setTorAddressUpgradeHandler(() -> log.info("setTorAddressUpgradeHandler")); havenoSetup.setTorAddressUpgradeHandler(() -> log.info("setTorAddressUpgradeHandler"));
corruptedStorageFileHandler.getFiles().ifPresent(files -> log.warn("getCorruptedDatabaseFiles. files={}", files)); corruptedStorageFileHandler.getFiles().ifPresent(files -> log.warn("getCorruptedDatabaseFiles. files={}", files));
tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> log.error("Error taking offer: " + errorMessage));
} }
public void stop() { public void stop() {

View File

@ -86,7 +86,6 @@ import javafx.beans.property.SimpleLongProperty;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import monero.daemon.model.MoneroTx; import monero.daemon.model.MoneroTx;
import monero.wallet.model.MoneroOutputQuery; import monero.wallet.model.MoneroOutputQuery;
import org.bitcoinj.core.Coin; import org.bitcoinj.core.Coin;
@ -149,9 +148,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
private final TradableList<Trade> tradableList = new TradableList<>(); private final TradableList<Trade> tradableList = new TradableList<>();
@Getter @Getter
private final BooleanProperty persistedTradesInitialized = new SimpleBooleanProperty(); private final BooleanProperty persistedTradesInitialized = new SimpleBooleanProperty();
@Setter
@Nullable
private ErrorMessageHandler takeOfferRequestErrorMessageHandler;
@Getter @Getter
private final LongProperty numPendingTrades = new SimpleLongProperty(); private final LongProperty numPendingTrades = new SimpleLongProperty();
private final ReferralIdService referralIdService; private final ReferralIdService referralIdService;
@ -613,7 +609,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
((ArbitratorProtocol) getTradeProtocol(trade)).handleInitTradeRequest(request, sender, errorMessage -> { ((ArbitratorProtocol) getTradeProtocol(trade)).handleInitTradeRequest(request, sender, errorMessage -> {
log.warn("Arbitrator error during trade initialization for trade {}: {}", trade.getId(), errorMessage); log.warn("Arbitrator error during trade initialization for trade {}: {}", trade.getId(), errorMessage);
maybeRemoveTradeOnError(trade); maybeRemoveTradeOnError(trade);
if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage);
}); });
requestPersistence(); requestPersistence();
@ -702,7 +697,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
((MakerProtocol) getTradeProtocol(trade)).handleInitTradeRequest(request, sender, errorMessage -> { ((MakerProtocol) getTradeProtocol(trade)).handleInitTradeRequest(request, sender, errorMessage -> {
log.warn("Maker error during trade initialization: " + errorMessage); log.warn("Maker error during trade initialization: " + errorMessage);
maybeRemoveTradeOnError(trade); maybeRemoveTradeOnError(trade);
if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage);
}); });
requestPersistence(); requestPersistence();
@ -893,7 +887,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
xmrWalletService.resetAddressEntriesForOpenOffer(trade.getId()); xmrWalletService.resetAddressEntriesForOpenOffer(trade.getId());
maybeRemoveTradeOnError(trade); maybeRemoveTradeOnError(trade);
errorMessageHandler.handleErrorMessage(errorMessage); errorMessageHandler.handleErrorMessage(errorMessage);
if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage);
}); });
requestPersistence(); requestPersistence();
} else { } else {
@ -903,7 +896,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
errorMessage -> { errorMessage -> {
log.warn("Taker error during check offer availability: " + errorMessage); log.warn("Taker error during check offer availability: " + errorMessage);
errorMessageHandler.handleErrorMessage(errorMessage); errorMessageHandler.handleErrorMessage(errorMessage);
if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage);
}); });
requestPersistence(); requestPersistence();

View File

@ -418,10 +418,6 @@ public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener
.useShutDownButton() .useShutDownButton()
.show()); .show());
tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> new Popup()
.warning(Res.get("popup.error.takeOfferRequestFailed", errorMessage))
.show());
havenoSetup.getXmrDaemonSyncProgress().addListener((observable, oldValue, newValue) -> updateXmrDaemonSyncProgress()); havenoSetup.getXmrDaemonSyncProgress().addListener((observable, oldValue, newValue) -> updateXmrDaemonSyncProgress());
havenoSetup.getXmrWalletSyncProgress().addListener((observable, oldValue, newValue) -> updateXmrWalletSyncProgress()); havenoSetup.getXmrWalletSyncProgress().addListener((observable, oldValue, newValue) -> updateXmrWalletSyncProgress());

View File

@ -226,8 +226,6 @@ class TakeOfferDataModel extends OfferDataModel {
// UI actions // UI actions
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// errorMessageHandler is used only in the check availability phase. As soon we have a trade we write the error msg in the trade object as we want to
// have it persisted as well.
void onTakeOffer(TradeResultHandler tradeResultHandler, ErrorMessageHandler errorMessageHandler) { void onTakeOffer(TradeResultHandler tradeResultHandler, ErrorMessageHandler errorMessageHandler) {
checkNotNull(getTakerFee(), "takerFee must not be null"); checkNotNull(getTakerFee(), "takerFee must not be null");

View File

@ -613,8 +613,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
errorMessageSubscription = EasyBind.subscribe(model.errorMessage, newValue -> { errorMessageSubscription = EasyBind.subscribe(model.errorMessage, newValue -> {
if (newValue != null) { if (newValue != null) {
new Popup().error(Res.get("takeOffer.error.message", model.errorMessage.get()) + "\n\n" + new Popup().warning(Res.get("takeOffer.error.message", model.errorMessage.get()))
Res.get("popup.error.tryRestart"))
.onClose(() -> { .onClose(() -> {
errorPopupDisplayed.set(true); errorPopupDisplayed.set(true);
model.resetErrorMessage(); model.resetErrorMessage();