mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-21 06:11:46 -04:00
log stack traces at warn or error level
This commit is contained in:
parent
8d55abe3b9
commit
50f3bd510a
42 changed files with 117 additions and 138 deletions
|
@ -52,6 +52,9 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
|
@ -204,7 +207,7 @@ public class CoreDisputesService {
|
|||
throw new IllegalStateException(errMessage, err);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
throw new IllegalStateException(e.getMessage() == null ? ("Error resolving dispute for trade " + trade.getId()) : e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
||||
@Singleton
|
||||
|
@ -161,7 +163,7 @@ class CoreTradesService {
|
|||
errorMessageHandler
|
||||
);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
errorMessageHandler.handleErrorMessage(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,9 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.LongProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
|
@ -464,7 +467,7 @@ public final class XmrConnectionService {
|
|||
log.info(getClass() + ".onAccountOpened() called");
|
||||
initialize();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("Error initializing connection service after account opened, error={}\n", e.getMessage(), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
@ -622,8 +625,7 @@ public final class XmrConnectionService {
|
|||
log.info("Starting local node");
|
||||
xmrLocalNode.startMoneroNode();
|
||||
} catch (Exception e) {
|
||||
log.warn("Unable to start local monero node: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.error("Unable to start local monero node, error={}\n", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -721,8 +723,8 @@ public final class XmrConnectionService {
|
|||
|
||||
// log error message periodically
|
||||
if (lastLogPollErrorTimestamp == null || System.currentTimeMillis() - lastLogPollErrorTimestamp > HavenoUtils.LOG_POLL_ERROR_PERIOD_MS) {
|
||||
log.warn("Failed to fetch daemon info, trying to switch to best connection: " + e.getMessage());
|
||||
if (DevEnv.isDevMode()) e.printStackTrace();
|
||||
log.warn("Failed to fetch daemon info, trying to switch to best connection, error={}", e.getMessage());
|
||||
if (DevEnv.isDevMode()) log.error(ExceptionUtils.getStackTrace(e));
|
||||
lastLogPollErrorTimestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public abstract class HavenoExecutable implements GracefulShutDownHandler, Haven
|
|||
System.exit(EXIT_FAILURE);
|
||||
} catch (Throwable ex) {
|
||||
System.err.println("fault: An unexpected error occurred. " +
|
||||
"Please file a report at https://haveno.exchange/issues");
|
||||
"Please file a report at https://github.com/haveno-dex/haveno/issues");
|
||||
ex.printStackTrace(System.err);
|
||||
System.exit(EXIT_FAILURE);
|
||||
}
|
||||
|
@ -201,8 +201,7 @@ public abstract class HavenoExecutable implements GracefulShutDownHandler, Haven
|
|||
startApplication();
|
||||
}
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
log.error("An error occurred: {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.error("An error occurred: {}\n", e.getMessage(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -362,7 +361,7 @@ public abstract class HavenoExecutable implements GracefulShutDownHandler, Haven
|
|||
try {
|
||||
ThreadUtils.awaitTasks(tasks, tasks.size(), 90000l); // run in parallel with timeout
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("Failed to notify all services to prepare for shutdown: {}\n", e.getMessage(), e);
|
||||
}
|
||||
|
||||
injector.getInstance(TradeManager.class).shutDown();
|
||||
|
@ -397,8 +396,7 @@ public abstract class HavenoExecutable implements GracefulShutDownHandler, Haven
|
|||
});
|
||||
});
|
||||
} catch (Throwable t) {
|
||||
log.error("App shutdown failed with exception {}", t.toString());
|
||||
t.printStackTrace();
|
||||
log.error("App shutdown failed with exception: {}\n", t.getMessage(), t);
|
||||
completeShutdown(resultHandler, EXIT_FAILURE, systemExit);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,8 +376,7 @@ public class HavenoSetup {
|
|||
moneroWalletRpcFile.setExecutable(true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.warn("Failed to install Monero binaries: " + e.toString());
|
||||
log.warn("Failed to install Monero binaries: {}\n", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
|
@ -48,8 +51,7 @@ public class TorSetup {
|
|||
if (resultHandler != null)
|
||||
resultHandler.run();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.toString());
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
if (errorMessageHandler != null)
|
||||
errorMessageHandler.handleErrorMessage(e.toString());
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ public abstract class ExecutableForAppWithP2p extends HavenoExecutable {
|
|||
try {
|
||||
ThreadUtils.awaitTasks(tasks, tasks.size(), 120000l); // run in parallel with timeout
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("Error awaiting tasks to complete: {}\n", e.getMessage(), e);
|
||||
}
|
||||
|
||||
JsonFileManager.shutDownAllInstances();
|
||||
|
@ -177,8 +177,7 @@ public abstract class ExecutableForAppWithP2p extends HavenoExecutable {
|
|||
}, 1);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
log.debug("App shutdown failed with exception");
|
||||
t.printStackTrace();
|
||||
log.info("App shutdown failed with exception: {}\n", t.getMessage(), t);
|
||||
PersistenceManager.flushAllDataToDiskAtShutdown(() -> {
|
||||
resultHandler.handleResult();
|
||||
log.info("Graceful shutdown resulted in an error. Exiting now.");
|
||||
|
|
|
@ -977,7 +977,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
// handle result
|
||||
resultHandler.handleResult(null);
|
||||
} catch (Exception e) {
|
||||
if (!openOffer.isCanceled()) e.printStackTrace();
|
||||
if (!openOffer.isCanceled()) log.error("Error processing pending offer: {}\n", e.getMessage(), e);
|
||||
errorMessageHandler.handleErrorMessage(e.getMessage());
|
||||
}
|
||||
}).start();
|
||||
|
@ -1365,9 +1365,8 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
});
|
||||
result = true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
errorMessage = "Exception at handleSignOfferRequest " + e.getMessage();
|
||||
log.error(errorMessage);
|
||||
log.error(errorMessage + "\n", e);
|
||||
} finally {
|
||||
sendAckMessage(request.getClass(), peer, request.getPubKeyRing(), request.getOfferId(), request.getUid(), result, errorMessage);
|
||||
}
|
||||
|
@ -1519,8 +1518,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
result = true;
|
||||
} catch (Throwable t) {
|
||||
errorMessage = "Exception at handleRequestIsOfferAvailableMessage " + t.getMessage();
|
||||
log.error(errorMessage);
|
||||
t.printStackTrace();
|
||||
log.error(errorMessage + "\n", t);
|
||||
} finally {
|
||||
sendAckMessage(request.getClass(), peer, request.getPubKeyRing(), request.getOfferId(), request.getUid(), result, errorMessage);
|
||||
}
|
||||
|
|
|
@ -59,8 +59,7 @@ public class FeeProvider extends HttpClientProvider {
|
|||
map.put(Config.BTC_TX_FEE, btcTxFee);
|
||||
map.put(Config.BTC_MIN_TX_FEE, btcMinTxFee);
|
||||
} catch (Throwable t) {
|
||||
log.error(t.toString());
|
||||
t.printStackTrace();
|
||||
log.error("Error getting fees: {}\n", t.getMessage(), t);
|
||||
}
|
||||
return new Tuple2<>(tsMap, map);
|
||||
}
|
||||
|
|
|
@ -68,8 +68,7 @@ public class PriceProvider extends HttpClientProvider {
|
|||
long timestampSec = MathUtils.doubleToLong((Double) treeMap.get("timestampSec"));
|
||||
marketPriceMap.put(currencyCode, new MarketPrice(currencyCode, price, timestampSec, true));
|
||||
} catch (Throwable t) {
|
||||
log.error(t.toString());
|
||||
t.printStackTrace();
|
||||
log.error("Error getting all prices: {}\n", t.getMessage(), t);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -83,6 +83,9 @@ import monero.wallet.model.MoneroTxConfig;
|
|||
import monero.wallet.model.MoneroTxWallet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.KeyPair;
|
||||
import java.time.Instant;
|
||||
|
@ -523,7 +526,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
|||
DisputeValidation.validateSenderNodeAddress(dispute, message.getSenderNodeAddress(), config);
|
||||
//DisputeValidation.testIfDisputeTriesReplay(dispute, disputeList.getList());
|
||||
} catch (DisputeValidation.ValidationException e) {
|
||||
e.printStackTrace();
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
validationExceptions.add(e);
|
||||
throw e;
|
||||
}
|
||||
|
@ -532,9 +535,9 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
|||
try {
|
||||
DisputeValidation.validatePaymentAccountPayload(dispute); // TODO: add field to dispute details: valid, invalid, missing
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.warn(e.getMessage());
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
trade.prependErrorMessage(e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
|
||||
// get sender
|
||||
|
@ -606,9 +609,8 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
errorMessage = e.getMessage();
|
||||
log.warn(errorMessage);
|
||||
if (trade != null) trade.setErrorMessage(errorMessage);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class DisputeSummaryVerification {
|
|||
disputeAgent = arbitratorManager.getDisputeAgentByNodeAddress(nodeAddress).orElse(null);
|
||||
checkNotNull(disputeAgent, "Dispute agent is null");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
log.error("Error verifying signature: {}\n", e.getMessage(), e);
|
||||
throw new IllegalArgumentException(Res.get("support.sigCheck.popup.invalidFormat"));
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class DisputeSummaryVerification {
|
|||
throw new IllegalArgumentException(Res.get("support.sigCheck.popup.failed"));
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
log.error("Error verifying signature with agent pub key ring: {}\n", e.getMessage(), e);
|
||||
throw new IllegalArgumentException(Res.get("support.sigCheck.popup.invalidFormat"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,8 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@Slf4j
|
||||
|
@ -355,7 +357,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
|
|||
requestPersistence(trade);
|
||||
} catch (Exception e) {
|
||||
log.warn("Error processing dispute closed message: {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn(ExceptionUtils.getStackTrace(e));
|
||||
requestPersistence(trade);
|
||||
|
||||
// nack bad message and do not reprocess
|
||||
|
@ -489,8 +491,7 @@ public final class ArbitrationManager extends DisputeManager<ArbitrationDisputeL
|
|||
try {
|
||||
feeEstimateTx = createDisputePayoutTx(trade, dispute.getContract(), disputeResult, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.warn("Could not recreate dispute payout tx to verify fee: " + e.getMessage());
|
||||
log.warn("Could not recreate dispute payout tx to verify fee: {}\n", e.getMessage(), e);
|
||||
}
|
||||
if (feeEstimateTx != null) {
|
||||
BigInteger feeEstimate = feeEstimateTx.getFee();
|
||||
|
|
|
@ -999,8 +999,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
xmrWalletService.deleteWallet(getWalletName());
|
||||
xmrWalletService.deleteWalletBackups(getWalletName());
|
||||
} catch (Exception e) {
|
||||
log.warn(e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn("Error deleting wallet for {} {}: {}\n", getClass().getSimpleName(), getId(), e.getMessage(), e);
|
||||
setErrorMessage(e.getMessage());
|
||||
processModel.getTradeManager().getNotificationService().sendErrorNotification("Error", e.getMessage());
|
||||
}
|
||||
|
@ -1538,8 +1537,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
try {
|
||||
ThreadUtils.awaitTask(shutDownTask, SHUTDOWN_TIMEOUT_MS);
|
||||
} catch (Exception e) {
|
||||
log.warn("Error shutting down {} {}: {}", getClass().getSimpleName(), getId(), e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn("Error shutting down {} {}: {}\n", getClass().getSimpleName(), getId(), e.getMessage(), e);
|
||||
|
||||
// force close wallet
|
||||
forceCloseWallet();
|
||||
|
@ -2819,8 +2817,7 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
processing = false;
|
||||
if (!isInitialized || isShutDownStarted) return;
|
||||
if (isWalletConnectedToDaemon()) {
|
||||
e.printStackTrace();
|
||||
log.warn("Error polling idle trade for {} {}: {}. Monerod={}", getClass().getSimpleName(), getId(), e.getMessage(), getXmrWalletService().getXmrConnectionService().getConnection());
|
||||
log.warn("Error polling idle trade for {} {}: {}. Monerod={}\n", getClass().getSimpleName(), getId(), e.getMessage(), getXmrWalletService().getXmrConnectionService().getConnection(), e);
|
||||
};
|
||||
}
|
||||
}, getId());
|
||||
|
|
|
@ -366,8 +366,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
trade.onShutDownStarted();
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null && e.getMessage().contains("Connection reset")) return; // expected if shut down with ctrl+c
|
||||
log.warn("Error notifying {} {} that shut down started {}", trade.getClass().getSimpleName(), trade.getId());
|
||||
e.printStackTrace();
|
||||
log.warn("Error notifying {} {} that shut down started: {}\n", trade.getClass().getSimpleName(), trade.getId(), e.getMessage(), e);
|
||||
}
|
||||
});
|
||||
try {
|
||||
|
@ -396,15 +395,13 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
trade.shutDown();
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage() != null && (e.getMessage().contains("Connection reset") || e.getMessage().contains("Connection refused"))) return; // expected if shut down with ctrl+c
|
||||
log.warn("Error closing {} {}", trade.getClass().getSimpleName(), trade.getId());
|
||||
e.printStackTrace();
|
||||
log.warn("Error closing {} {}: {}", trade.getClass().getSimpleName(), trade.getId(), e.getMessage(), e);
|
||||
}
|
||||
});
|
||||
try {
|
||||
ThreadUtils.awaitTasks(tasks);
|
||||
} catch (Exception e) {
|
||||
log.warn("Error shutting down trades: {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn("Error shutting down trades: {}\n", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,8 +459,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
}
|
||||
} catch (Exception e) {
|
||||
if (!isShutDownStarted) {
|
||||
e.printStackTrace();
|
||||
log.warn("Error initializing {} {}: {}", trade.getClass().getSimpleName(), trade.getId(), e.getMessage());
|
||||
log.warn("Error initializing {} {}: {}\n", trade.getClass().getSimpleName(), trade.getId(), e.getMessage(), e);
|
||||
trade.setInitError(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ArbitratorProcessDepositRequest extends TradeTask {
|
|||
complete();
|
||||
} catch (Throwable t) {
|
||||
this.error = t;
|
||||
t.printStackTrace();
|
||||
log.error("Error processing deposit request for trade {}: {}\n", trade.getId(), t.getMessage(), t);
|
||||
trade.setStateIfValidTransitionTo(Trade.State.PUBLISH_DEPOSIT_TX_REQUEST_FAILED);
|
||||
failed(t);
|
||||
}
|
||||
|
@ -155,15 +155,14 @@ public class ArbitratorProcessDepositRequest extends TradeTask {
|
|||
log.info("Arbitrator published deposit txs for trade " + trade.getId());
|
||||
trade.setStateIfValidTransitionTo(Trade.State.ARBITRATOR_PUBLISHED_DEPOSIT_TXS);
|
||||
} catch (Exception e) {
|
||||
log.warn("Arbitrator error publishing deposit txs for trade {} {}: {}", trade.getClass().getSimpleName(), trade.getShortId(), e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn("Arbitrator error publishing deposit txs for trade {} {}: {}\n", trade.getClass().getSimpleName(), trade.getShortId(), e.getMessage(), e);
|
||||
if (!depositTxsRelayed) {
|
||||
|
||||
// flush txs from pool
|
||||
try {
|
||||
daemon.flushTxPool(processModel.getMaker().getDepositTxHash(), processModel.getTaker().getDepositTxHash());
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
log.warn("Error flushing deposit txs from pool for trade {}: {}\n", trade.getId(), e2.getMessage(), e2);
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
|
|
|
@ -29,6 +29,8 @@ import monero.daemon.model.MoneroTx;
|
|||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
/**
|
||||
* Arbitrator verifies reserve tx from maker or taker.
|
||||
*
|
||||
|
@ -73,7 +75,7 @@ public class ArbitratorProcessReserveTx extends TradeTask {
|
|||
request.getReserveTxKey(),
|
||||
null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(ExceptionUtils.getStackTrace(e));
|
||||
throw new RuntimeException("Error processing reserve tx from " + (isFromMaker ? "maker " : "taker ") + processModel.getTempTradePeerNodeAddress() + ", offerId=" + offer.getId() + ": " + e.getMessage());
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public class MaybeResendDisputeClosedMessageWithPayout extends TradeTask {
|
|||
HavenoUtils.arbitrationManager.closeDisputeTicket(dispute.getDisputeResultProperty().get(), dispute, dispute.getDisputeResultProperty().get().summaryNotesProperty().get(), () -> {
|
||||
completeAux();
|
||||
}, (errMessage, err) -> {
|
||||
err.printStackTrace();
|
||||
log.error("Failed to close dispute ticket for trade {}: {}\n", trade.getId(), errMessage, err);
|
||||
failed(err);
|
||||
});
|
||||
ticketClosed = true;
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ProcessDepositsConfirmedMessage extends TradeTask {
|
|||
try {
|
||||
trade.importMultisigHex();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.warn("Error importing multisig hex on deposits confirmed for trade " + trade.getId() + ": " + e.getMessage() + "\n", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public abstract class TradeTask extends Task<Trade> {
|
|||
|
||||
@Override
|
||||
protected void failed(Throwable t) {
|
||||
t.printStackTrace();
|
||||
log.error("Trade task failed, error={}\n", t.getMessage(), t);
|
||||
appendExceptionToErrorMessage(t);
|
||||
trade.setErrorMessage(errorMessage);
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
|
|
@ -6,6 +6,8 @@ import java.util.Optional;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
|
||||
import haveno.common.Timer;
|
||||
import haveno.common.UserThread;
|
||||
import haveno.core.api.XmrConnectionService;
|
||||
|
@ -106,7 +108,7 @@ public class XmrWalletBase {
|
|||
height = wallet.getHeight(); // can get read timeout while syncing
|
||||
} catch (Exception e) {
|
||||
log.warn("Error getting wallet height while syncing with progress: " + e.getMessage());
|
||||
if (wallet != null && !isShutDownStarted) e.printStackTrace();
|
||||
if (wallet != null && !isShutDownStarted) log.warn(ExceptionUtils.getStackTrace(e));
|
||||
|
||||
// stop polling and release latch
|
||||
syncProgressError = e;
|
||||
|
|
|
@ -818,7 +818,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
MoneroFeeEstimate feeEstimates = getDaemon().getFeeEstimate();
|
||||
BigInteger baseFeeEstimate = feeEstimates.getFees().get(2); // get elevated fee per kB
|
||||
BigInteger qmask = feeEstimates.getQuantizationMask();
|
||||
log.info("Monero base fee estimate={}, qmask={}: " + baseFeeEstimate, qmask);
|
||||
log.info("Monero base fee estimate={}, qmask={}", baseFeeEstimate, qmask);
|
||||
|
||||
// get tx base fee
|
||||
BigInteger baseFee = baseFeeEstimate.multiply(BigInteger.valueOf(txWeight));
|
||||
|
@ -922,8 +922,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
try {
|
||||
ThreadUtils.awaitTask(shutDownTask, SHUTDOWN_TIMEOUT_MS);
|
||||
} catch (Exception e) {
|
||||
log.warn("Error shutting down {}: {}", getClass().getSimpleName(), e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn("Error shutting down {}: {}\n", getClass().getSimpleName(), e.getMessage(), e);
|
||||
|
||||
// force close wallet
|
||||
forceCloseMainWallet();
|
||||
|
@ -945,8 +944,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
List<XmrAddressEntry> unusedAddressEntries = getUnusedAddressEntries();
|
||||
if (!unusedAddressEntries.isEmpty()) return xmrAddressEntryList.swapAvailableToAddressEntryWithOfferId(unusedAddressEntries.get(0), context, offerId);
|
||||
} catch (Exception e) {
|
||||
log.warn("Error getting new address entry based on incoming transactions");
|
||||
e.printStackTrace();
|
||||
log.warn("Error getting new address entry based on incoming transactions: {}\n", e.getMessage(), e);
|
||||
}
|
||||
|
||||
// create new entry
|
||||
|
@ -1172,8 +1170,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
try {
|
||||
balanceListener.onBalanceChanged(balance);
|
||||
} catch (Exception e) {
|
||||
log.warn("Failed to notify balance listener of change");
|
||||
e.printStackTrace();
|
||||
log.warn("Failed to notify balance listener of change: {}\n", e.getMessage(), e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1309,8 +1306,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
try {
|
||||
doMaybeInitMainWallet(sync, MAX_SYNC_ATTEMPTS);
|
||||
} catch (Exception e) {
|
||||
log.warn("Error initializing main wallet: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn("Error initializing main wallet: {}\n", e.getMessage(), e);
|
||||
HavenoUtils.setTopError(e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
|
@ -1459,9 +1455,10 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
log.info("Done creating full wallet " + config.getPath() + " in " + (System.currentTimeMillis() - time) + " ms");
|
||||
return walletFull;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String errorMsg = "Could not create wallet '" + config.getPath() + "': " + e.getMessage();
|
||||
log.warn(errorMsg + "\n", e);
|
||||
if (walletFull != null) forceCloseWallet(walletFull, config.getPath());
|
||||
throw new IllegalStateException("Could not create wallet '" + config.getPath() + "'");
|
||||
throw new IllegalStateException(errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1525,9 +1522,10 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
log.info("Done opening full wallet " + config.getPath());
|
||||
return walletFull;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
String errorMsg = "Could not open full wallet '" + config.getPath() + "': " + e.getMessage();
|
||||
log.warn(errorMsg + "\n", e);
|
||||
if (walletFull != null) forceCloseWallet(walletFull, config.getPath());
|
||||
throw new IllegalStateException("Could not open full wallet '" + config.getPath() + "'");
|
||||
throw new IllegalStateException(errorMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1557,7 +1555,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
log.info("Done creating RPC wallet " + config.getPath() + " in " + (System.currentTimeMillis() - time) + " ms");
|
||||
return walletRpc;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.warn("Could not create wallet '" + config.getPath() + "': " + e.getMessage() + "\n", e);
|
||||
if (walletRpc != null) forceCloseWallet(walletRpc, config.getPath());
|
||||
throw new IllegalStateException("Could not create wallet '" + config.getPath() + "'. Please close Haveno, stop all monero-wallet-rpc processes in your task manager, and restart Haveno.");
|
||||
}
|
||||
|
@ -1629,7 +1627,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
log.info("Done opening RPC wallet " + config.getPath());
|
||||
return walletRpc;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.warn("Could not open wallet '" + config.getPath() + "': " + e.getMessage() + "\n", e);
|
||||
if (walletRpc != null) forceCloseWallet(walletRpc, config.getPath());
|
||||
throw new IllegalStateException("Could not open wallet '" + config.getPath() + "'. Please close Haveno, stop all monero-wallet-rpc processes in your task manager, and restart Haveno.\n\nError message: " + e.getMessage());
|
||||
}
|
||||
|
@ -1733,7 +1731,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
wallet.changePassword(oldPassword, newPassword);
|
||||
saveMainWallet();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.warn("Error changing main wallet password: " + e.getMessage() + "\n", e);
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
@ -1916,7 +1914,7 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
cacheWalletInfo();
|
||||
requestSaveMainWallet();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.warn("Error caching wallet info: " + e.getMessage() + "\n", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue