From 342c212ba8384eda40e842e32510bfacff27c101 Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 29 Dec 2023 09:11:36 -0500 Subject: [PATCH] remove global error handler for taking offer --- core/src/main/java/haveno/core/app/HavenoHeadlessApp.java | 1 - core/src/main/java/haveno/core/trade/TradeManager.java | 8 -------- .../src/main/java/haveno/desktop/main/MainViewModel.java | 4 ---- .../desktop/main/offer/takeoffer/TakeOfferDataModel.java | 2 -- .../desktop/main/offer/takeoffer/TakeOfferView.java | 3 +-- 5 files changed, 1 insertion(+), 17 deletions(-) diff --git a/core/src/main/java/haveno/core/app/HavenoHeadlessApp.java b/core/src/main/java/haveno/core/app/HavenoHeadlessApp.java index 73bcccedd2..8131923ad4 100644 --- a/core/src/main/java/haveno/core/app/HavenoHeadlessApp.java +++ b/core/src/main/java/haveno/core/app/HavenoHeadlessApp.java @@ -93,7 +93,6 @@ public class HavenoHeadlessApp implements HeadlessApp { lastVersion, Version.VERSION)); havenoSetup.setTorAddressUpgradeHandler(() -> log.info("setTorAddressUpgradeHandler")); corruptedStorageFileHandler.getFiles().ifPresent(files -> log.warn("getCorruptedDatabaseFiles. files={}", files)); - tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> log.error("Error taking offer: " + errorMessage)); } public void stop() { diff --git a/core/src/main/java/haveno/core/trade/TradeManager.java b/core/src/main/java/haveno/core/trade/TradeManager.java index 44aaab6184..4ea756fbe0 100644 --- a/core/src/main/java/haveno/core/trade/TradeManager.java +++ b/core/src/main/java/haveno/core/trade/TradeManager.java @@ -86,7 +86,6 @@ import javafx.beans.property.SimpleLongProperty; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import lombok.Getter; -import lombok.Setter; import monero.daemon.model.MoneroTx; import monero.wallet.model.MoneroOutputQuery; import org.bitcoinj.core.Coin; @@ -149,9 +148,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi private final TradableList tradableList = new TradableList<>(); @Getter private final BooleanProperty persistedTradesInitialized = new SimpleBooleanProperty(); - @Setter - @Nullable - private ErrorMessageHandler takeOfferRequestErrorMessageHandler; @Getter private final LongProperty numPendingTrades = new SimpleLongProperty(); private final ReferralIdService referralIdService; @@ -613,7 +609,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi ((ArbitratorProtocol) getTradeProtocol(trade)).handleInitTradeRequest(request, sender, errorMessage -> { log.warn("Arbitrator error during trade initialization for trade {}: {}", trade.getId(), errorMessage); maybeRemoveTradeOnError(trade); - if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage); }); requestPersistence(); @@ -702,7 +697,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi ((MakerProtocol) getTradeProtocol(trade)).handleInitTradeRequest(request, sender, errorMessage -> { log.warn("Maker error during trade initialization: " + errorMessage); maybeRemoveTradeOnError(trade); - if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage); }); requestPersistence(); @@ -893,7 +887,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi xmrWalletService.resetAddressEntriesForOpenOffer(trade.getId()); maybeRemoveTradeOnError(trade); errorMessageHandler.handleErrorMessage(errorMessage); - if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage); }); requestPersistence(); } else { @@ -903,7 +896,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi errorMessage -> { log.warn("Taker error during check offer availability: " + errorMessage); errorMessageHandler.handleErrorMessage(errorMessage); - if (takeOfferRequestErrorMessageHandler != null) takeOfferRequestErrorMessageHandler.handleErrorMessage(errorMessage); }); requestPersistence(); diff --git a/desktop/src/main/java/haveno/desktop/main/MainViewModel.java b/desktop/src/main/java/haveno/desktop/main/MainViewModel.java index e95ba03bab..76558bb64f 100644 --- a/desktop/src/main/java/haveno/desktop/main/MainViewModel.java +++ b/desktop/src/main/java/haveno/desktop/main/MainViewModel.java @@ -418,10 +418,6 @@ public class MainViewModel implements ViewModel, HavenoSetup.HavenoSetupListener .useShutDownButton() .show()); - tradeManager.setTakeOfferRequestErrorMessageHandler(errorMessage -> new Popup() - .warning(Res.get("popup.error.takeOfferRequestFailed", errorMessage)) - .show()); - havenoSetup.getXmrDaemonSyncProgress().addListener((observable, oldValue, newValue) -> updateXmrDaemonSyncProgress()); havenoSetup.getXmrWalletSyncProgress().addListener((observable, oldValue, newValue) -> updateXmrWalletSyncProgress()); diff --git a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferDataModel.java index 5acbec9ee8..72571eb634 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferDataModel.java @@ -226,8 +226,6 @@ class TakeOfferDataModel extends OfferDataModel { // 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) { checkNotNull(getTakerFee(), "takerFee must not be null"); diff --git a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferView.java b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferView.java index 8c29f69111..1082dce774 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferView.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferView.java @@ -613,8 +613,7 @@ public class TakeOfferView extends ActivatableViewAndModel { if (newValue != null) { - new Popup().error(Res.get("takeOffer.error.message", model.errorMessage.get()) + "\n\n" + - Res.get("popup.error.tryRestart")) + new Popup().warning(Res.get("takeOffer.error.message", model.errorMessage.get())) .onClose(() -> { errorPopupDisplayed.set(true); model.resetErrorMessage();