Add error handling for missing providers in rotation configuration

- Check if provider exists in configuration before creating handler
- Log error with available providers when provider is not found
- Skip providers that don't exist instead of crashing
- Prevents AttributeError when rotation references non-existent provider
parent 1545c2cc
......@@ -181,6 +181,15 @@ class RotationHandler:
logger.info(f"")
logger.info(f"--- Processing provider: {provider_id} ---")
# Check if provider exists in configuration
provider_config = self.config.get_provider(provider_id)
if not provider_config:
logger.error(f" [ERROR] Provider {provider_id} not found in providers configuration")
logger.error(f" Available providers: {list(self.config.providers.keys())}")
logger.error(f" Skipping this provider")
skipped_providers.append(provider_id)
continue
# Check if provider is rate limited/deactivated
provider_handler = get_provider_handler(provider_id, provider.get('api_key'))
if provider_handler.is_rate_limited():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment