diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 8883a11b8..6bc779d05 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -1094,7 +1094,7 @@ class RPC: trade = Trade.get_trades(trade_filter=[Trade.id == trade_id]).first() if not trade: logger.warning("delete trade: Invalid argument received") - raise RPCException("invalid argument") + raise RPCException(f"Trade with id '{trade_id}' not found.") # Try cancelling regular order if that exists for open_order in trade.open_orders: diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index d8fe14d1a..3c8490d44 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -393,7 +393,7 @@ def test_rpc_delete_trade(mocker, default_conf, fee, markets, caplog, is_short): freqtradebot.strategy.order_types["stoploss_on_exchange"] = True create_mock_trades(fee, is_short) rpc = RPC(freqtradebot) - with pytest.raises(RPCException, match="invalid argument"): + with pytest.raises(RPCException, match="Trade with id '200' not found."): rpc._rpc_delete("200") trades = Trade.session.scalars(select(Trade)).all()