Skip to content

Commit

Permalink
[Community] raise InvalidBotConfigError on missing config
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeDSM committed Dec 7, 2024
1 parent 88debc9 commit e86cc35
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) as err:
raise errors.InvalidBotConfigError(f"Missing bot product config: {err} ({err.__class__.__name__})") from err
profile_data.profile_details.name = bot_config["product_config"].get("product", {}).get(
"slug", profile_data.profile_details.name
)
Expand Down

0 comments on commit e86cc35

Please sign in to comment.