mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-12-16 00:04:09 -05:00
log stack trace for unexpected polling errors
This commit is contained in:
parent
bb2704c390
commit
a09c3a2079
3 changed files with 14 additions and 6 deletions
|
|
@ -3319,10 +3319,10 @@ public abstract class Trade extends XmrWalletBase implements Tradable, Model {
|
|||
} else {
|
||||
boolean isWalletConnected = isWalletConnectedToDaemon();
|
||||
if (wallet != null && !isShutDownStarted && isWalletConnected) {
|
||||
if (e instanceof NullPointerException) {
|
||||
log.warn("Error polling trade wallet for {} {}, errorMessage={}. Monerod={}", getClass().getSimpleName(), getShortId(), e.getMessage(), wallet.getDaemonConnection(), e);
|
||||
} else {
|
||||
if (isExpectedWalletError(e)) {
|
||||
log.warn("Error polling trade wallet for {} {}, errorMessage={}. Monerod={}", getClass().getSimpleName(), getShortId(), e.getMessage(), wallet.getDaemonConnection());
|
||||
} else {
|
||||
log.warn("Error polling trade wallet for {} {}, errorMessage={}. Monerod={}", getClass().getSimpleName(), getShortId(), e.getMessage(), wallet.getDaemonConnection(), e); // include stack trace for unexpected errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ public abstract class XmrWalletBase {
|
|||
// constants
|
||||
private static final int SYNC_TIMEOUT_SECONDS = 180;
|
||||
private static final String SYNC_TIMEOUT_MSG = "Sync timeout called";
|
||||
private static final String RECEIVED_ERROR_RESPONSE_MSG = "Received error response from RPC request";
|
||||
private static final long SAVE_AFTER_ELAPSED_SECONDS = 300;
|
||||
private Object saveIntervalLock = new Object();
|
||||
protected long lastSaveTimeMs = 0;
|
||||
|
|
@ -96,7 +97,7 @@ public abstract class XmrWalletBase {
|
|||
future.cancel(true);
|
||||
throw new RuntimeException(SYNC_TIMEOUT_MSG, e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException("Sync failed", e.getCause());
|
||||
throw new RuntimeException("Sync failed", e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt(); // restore interrupt status
|
||||
throw new RuntimeException("Sync was interrupted", e);
|
||||
|
|
@ -281,4 +282,8 @@ public abstract class XmrWalletBase {
|
|||
// update state
|
||||
wasWalletSynced = true;
|
||||
}
|
||||
|
||||
protected boolean isExpectedWalletError(Exception e) {
|
||||
return e.getMessage() != null && e.getMessage().contains(RECEIVED_ERROR_RESPONSE_MSG); // TODO: why does this error happen "normally"?
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2050,8 +2050,11 @@ public class XmrWalletService extends XmrWalletBase {
|
|||
if (wallet == null || isShutDownStarted) return;
|
||||
if (HavenoUtils.isUnresponsive(e)) forceRestartMainWallet();
|
||||
else if (isWalletConnectedToDaemon()) {
|
||||
log.warn("Error polling main wallet, errorMessage={}. Monerod={}", e.getMessage(), getXmrConnectionService().getConnection());
|
||||
//e.printStackTrace();
|
||||
if (isExpectedWalletError(e)) {
|
||||
log.warn("Error polling main wallet, errorMessage={}. Monerod={}", e.getMessage(), getXmrConnectionService().getConnection());
|
||||
} else {
|
||||
log.warn("Error polling main wallet, errorMessage={}. Monerod={}", e.getMessage(), getXmrConnectionService().getConnection(), e); // include stack trace for unexpected errors
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (pollInProgressSet) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue