From 92984c4e22dab15245a602a10cab777e038fe244 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Sat, 7 Dec 2024 19:38:27 +0100 Subject: [PATCH] [Community] raise InvalidBotConfigError on missing config --- .../supabase_backend/community_supabase_client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/octobot/community/supabase_backend/community_supabase_client.py b/octobot/community/supabase_backend/community_supabase_client.py index 3c0b4498e..5223f6531 100644 --- a/octobot/community/supabase_backend/community_supabase_client.py +++ b/octobot/community/supabase_backend/community_supabase_client.py @@ -427,9 +427,12 @@ async def fetch_bot_profile_data(self, bot_config_id: str) -> commons_profiles.P " product:products!product_id(slug, attributes)" ")" ).eq(enums.BotConfigKeys.ID.value, bot_config_id).execute()).data[0] - profile_data = commons_profiles.ProfileData.from_dict( - bot_config["product_config"][enums.ProfileConfigKeys.CONFIG.value] - ) + try: + profile_data = commons_profiles.ProfileData.from_dict( + bot_config["product_config"][enums.ProfileConfigKeys.CONFIG.value] + ) + except (TypeError, KeyError): + raise errors.InvalidBotConfigError("Missing bot product config") profile_data.profile_details.name = bot_config["product_config"].get("product", {}).get( "slug", profile_data.profile_details.name )