Improve error messages

This commit is contained in:
Matthias 2023-01-31 19:38:43 +01:00
parent bbc663fce1
commit 9cfbb21cd7
2 changed files with 6 additions and 2 deletions

View File

@ -822,10 +822,10 @@ class RPC:
).first() ).first()
if not trade: if not trade:
logger.warning('cancel_open_order: Invalid trade_id received.') logger.warning('cancel_open_order: Invalid trade_id received.')
raise RPCException('Invalid trade_id') raise RPCException('Invalid trade_id.')
if not trade.open_order_id: if not trade.open_order_id:
logger.warning('cancel_open_order: No open order for trade_id.') logger.warning('cancel_open_order: No open order for trade_id.')
raise RPCException('No open order for trade_id') raise RPCException('No open order for trade_id.')
try: try:
order = self._freqtrade.exchange.fetch_order(trade.open_order_id, trade.pair) order = self._freqtrade.exchange.fetch_order(trade.open_order_id, trade.pair)

View File

@ -720,6 +720,10 @@ def test_api_delete_open_order(botclient, mocker, fee, markets, ticker, is_short
cancel_stoploss_order=stoploss_mock, cancel_stoploss_order=stoploss_mock,
) )
rc = client_delete(client, f"{BASE_URI}/trades/10/open-order")
assert_response(rc, 502)
assert 'Invalid trade_id.' in rc.json()['error']
create_mock_trades(fee, is_short=is_short) create_mock_trades(fee, is_short=is_short)
trades = Trade.query.all() trades = Trade.query.all()