mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
- Add custom OAuth2 error classes (OAuth2Error, OAuth2ConfigurationError, OAuth2AuthenticationError, OAuth2ValidationError) - Implement URL and scope validation in OAuth2Config using pydantic field_validator - Add retry mechanism with exponential backoff (3 attempts, 1s/2s/4s delays) to OAuth2TokenManager - Implement thread safety using threading.Lock for concurrent token access - Add provider validation in LLM integration with _validate_oauth2_provider method - Enhance testing with validation, retry, thread safety, and error class tests - Improve documentation with comprehensive error handling examples and feature descriptions - Maintain backward compatibility while significantly improving robustness and security Co-Authored-By: João <joao@crewai.com>
27 lines
668 B
Python
27 lines
668 B
Python
"""OAuth2 error classes for CrewAI."""
|
|
|
|
from typing import Optional
|
|
|
|
|
|
class OAuth2Error(Exception):
|
|
"""Base exception class for OAuth2 operation errors."""
|
|
|
|
def __init__(self, message: str, original_error: Optional[Exception] = None):
|
|
super().__init__(message)
|
|
self.original_error = original_error
|
|
|
|
|
|
class OAuth2ConfigurationError(OAuth2Error):
|
|
"""Exception raised for OAuth2 configuration errors."""
|
|
pass
|
|
|
|
|
|
class OAuth2AuthenticationError(OAuth2Error):
|
|
"""Exception raised for OAuth2 authentication failures."""
|
|
pass
|
|
|
|
|
|
class OAuth2ValidationError(OAuth2Error):
|
|
"""Exception raised for OAuth2 validation errors."""
|
|
pass
|