Skip to content

Commit

Permalink
Improve exception handling to match Codacy rules
Browse files Browse the repository at this point in the history
Rewrite a few generic parts of the code to be more specific in what they
 handle, or how they handle the resulting data structure.
  • Loading branch information
cd2357 committed Aug 8, 2020
1 parent 8c13a9e commit 233af83
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,15 @@ public Collection<CurrencyPair> getCurrencyPairs() {
log.error("Could not query tickers for " + getName(), e);
}
});
} catch (ExchangeException | // Errors reported by the exchange (rate limit, etc)
IOException | // Errors while trying to connect to the API (timeouts, etc)
IllegalArgumentException // Potential error when integrating new exchange
// (hints that exchange impl. needs to overwrite
// requiresFilterDuringBulkTickerRetrieval()
// and have it return true )
e) {
} catch (
// Errors reported by the exchange (rate limit, etc)
ExchangeException |
// Errors while trying to connect to the API (timeouts, etc)
IOException |
// Potential error when integrating new exchange (hints that exchange
// provider implementation needs to overwrite
// requiresFilterDuringBulkTickerRetrieval() and have it return true )
IllegalArgumentException e) {
// Catch and handle all other possible exceptions
// If there was a problem with polling this exchange, return right away,
// since there are no results to parse and process
Expand All @@ -243,8 +245,7 @@ public Collection<CurrencyPair> getCurrencyPairs() {
String otherExchangeRateCurrency;
if (t.getCurrencyPair().base.equals(Currency.BTC)) {
otherExchangeRateCurrency = t.getCurrencyPair().counter.getCurrencyCode();
}
else {
} else {
otherExchangeRateCurrency = t.getCurrencyPair().base.getCurrencyCode();
}

Expand Down

0 comments on commit 233af83

Please sign in to comment.