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:
@@ -1169,13 +1169,12 @@ class RPC:
|
||||
|
||||
# Handle case when there is no custom data found across trades.
|
||||
if not results:
|
||||
message_details = "found for any open trades."
|
||||
if key and trade_id:
|
||||
message_details = f"with key '{key}' found for Trade ID: {trade_id}."
|
||||
elif trade_id:
|
||||
message_details = f"found for Trade ID: {trade_id}."
|
||||
elif key:
|
||||
message_details = f"with key '{key}' found for any open trades."
|
||||
message_details = ""
|
||||
if key:
|
||||
message_details += f"with key '{key}' "
|
||||
message_details += (
|
||||
f"found for Trade ID: {trade_id}." if trade_id else "found for any open trades."
|
||||
)
|
||||
raise RPCException(f"No custom-data {message_details}")
|
||||
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user