Search in sources :

Example 1 with NonceException

use of org.knowm.xchange.exceptions.NonceException in project XChange by knowm.

the class BitfinexErrorAdapter method adapt.

public static ExchangeException adapt(BitfinexException e) {
    String message = e.getMessage();
    if (StringUtils.isEmpty(message)) {
        return new ExchangeException(e);
    }
    message = message.toLowerCase();
    if (message.contains("unknown symbol") || message.contains("symbol: invalid")) {
        return new CurrencyPairNotValidException(message, e);
    } else if (message.contains("not enough exchange balance")) {
        return new FundsExceededException(message, e);
    } else if (message.contains("err_rate_limit") || message.contains("ratelimit")) {
        return new RateLimitExceededException(e);
    } else if (message.contains("nonce")) {
        return new NonceException(e);
    }
    return new ExchangeException(message, e);
}
Also used : NonceException(org.knowm.xchange.exceptions.NonceException) CurrencyPairNotValidException(org.knowm.xchange.exceptions.CurrencyPairNotValidException) ExchangeException(org.knowm.xchange.exceptions.ExchangeException) RateLimitExceededException(org.knowm.xchange.exceptions.RateLimitExceededException) FundsExceededException(org.knowm.xchange.exceptions.FundsExceededException)

Aggregations

CurrencyPairNotValidException (org.knowm.xchange.exceptions.CurrencyPairNotValidException)1 ExchangeException (org.knowm.xchange.exceptions.ExchangeException)1 FundsExceededException (org.knowm.xchange.exceptions.FundsExceededException)1 NonceException (org.knowm.xchange.exceptions.NonceException)1 RateLimitExceededException (org.knowm.xchange.exceptions.RateLimitExceededException)1