Skip to content

Commit

Permalink
Merge pull request #4991 from bigscoop/coinex
Browse files Browse the repository at this point in the history
[coinex] Extend error mapping
  • Loading branch information
timmolter authored Jan 20, 2025
2 parents 4430a5f + 72f6431 commit 9b25a34
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@
import org.knowm.xchange.coinex.dto.CoinexException;
import org.knowm.xchange.exceptions.ExchangeException;
import org.knowm.xchange.exceptions.InstrumentNotValidException;
import org.knowm.xchange.exceptions.OrderAmountUnderMinimumException;
import org.knowm.xchange.exceptions.OrderNotValidException;

@UtilityClass
public class CoinexErrorAdapter {

public final int AMOUNT_TOO_SMALL = 3127;
public final int ORDER_NOT_FOUND = 3600;
public final int INVALID_MARKET_CODE = 3639;

public ExchangeException adapt(CoinexException e) {

switch (e.getCode()) {
case AMOUNT_TOO_SMALL:
return new OrderAmountUnderMinimumException(e.getMessage(), e);

case ORDER_NOT_FOUND:
return new OrderNotValidException(e.getMessage(), e);

Expand Down

0 comments on commit 9b25a34

Please sign in to comment.