mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-17 13:21:15 +00:00
chore: simplify error handling in _rpc_list_custom_data
This commit is contained in:
@@ -1167,16 +1167,15 @@ class RPC:
|
|||||||
]
|
]
|
||||||
results.append({"trade_id": trade.id, "custom_data": formatted_custom_data})
|
results.append({"trade_id": trade.id, "custom_data": formatted_custom_data})
|
||||||
|
|
||||||
# Handle case when there is no custom data found across trades.
|
# Handle case when there is no custom data found across trades.
|
||||||
if not results:
|
if not results:
|
||||||
message_details = "found for any open trades."
|
message_details = ""
|
||||||
if key and trade_id:
|
if key:
|
||||||
message_details = f"with key '{key}' found for Trade ID: {trade_id}."
|
message_details += f"with key '{key}' "
|
||||||
elif trade_id:
|
message_details += (
|
||||||
message_details = f"found for Trade ID: {trade_id}."
|
f"found for Trade ID: {trade_id}." if trade_id else "found for any open trades."
|
||||||
elif key:
|
)
|
||||||
message_details = f"with key '{key}' found for any open trades."
|
raise RPCException(f"No custom-data {message_details}")
|
||||||
raise RPCException(f"No custom-data {message_details}")
|
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user