mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-04 13:26:44 +00:00
reduce error logging when fee and exchanges rate sources are unavailable
This commit is contained in:
parent
dcc63046bd
commit
57eb3a77e7
2 changed files with 16 additions and 4 deletions
|
@ -56,7 +56,11 @@ public enum ExchangeSource {
|
|||
Gson gson = new Gson();
|
||||
return gson.fromJson(reader, CoinbaseRates.class);
|
||||
} catch (Exception e) {
|
||||
log.error("Error retrieving currency rates", e);
|
||||
if(log.isDebugEnabled()) {
|
||||
log.warn("Error retrieving currency rates", e);
|
||||
} else {
|
||||
log.warn("Error retrieving currency rates (" + e.getMessage() + ")");
|
||||
}
|
||||
return new CoinbaseRates();
|
||||
}
|
||||
}
|
||||
|
@ -86,8 +90,12 @@ public enum ExchangeSource {
|
|||
try(InputStream is = (proxy == null ? new URL(url).openStream() : new URL(url).openConnection(proxy).getInputStream()); Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) {
|
||||
Gson gson = new Gson();
|
||||
return gson.fromJson(reader, CoinGeckoRates.class);
|
||||
} catch (Exception e) {
|
||||
log.error("Error retrieving currency rates", e);
|
||||
} catch(Exception e) {
|
||||
if(log.isDebugEnabled()) {
|
||||
log.warn("Error retrieving currency rates", e);
|
||||
} else {
|
||||
log.warn("Error retrieving currency rates (" + e.getMessage() + ")");
|
||||
}
|
||||
return new CoinGeckoRates();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,11 @@ public enum FeeRatesSource {
|
|||
blockTargetFeeRates.put(Integer.MAX_VALUE, threeTierRates.minimumFee);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Error retrieving recommended fee rates from " + url, e);
|
||||
if(log.isDebugEnabled()) {
|
||||
log.warn("Error retrieving recommended fee rates from " + url, e);
|
||||
} else {
|
||||
log.warn("Error retrieving recommended fee rates from " + url + " (" + e.getMessage() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
return blockTargetFeeRates;
|
||||
|
|
Loading…
Reference in a new issue