chore: add comprehensive error handling and logging infrastructure #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds comprehensive error handling infrastructure with custom exceptions, centralized logging, and retry mechanisms for resilient API calls.
Changes
pr_review/exceptions.pyCustom exception hierarchy:
PRReviewError: Base exception for all PR review errorsGitHubAPIError: GitHub API failures with status code trackingMetricsCalculationError: Metrics computation failuresAILabelingError: AI labeling service failuresReviewerAssignmentError: Reviewer assignment failuresDiscordNotificationError: Discord notification failuresConfigurationError: Configuration validation errorsValidationError: Input validation errorspr_review/logging_config.pyCentralized logging utilities:
setup_logging(): Configure logging with console and file outputLoggerMixin: Add logging to any class via inheritanceLogLevel: Context manager for temporary log level changespr_review/utils/retry_utils.pyRetry and resilience utilities:
@retry: Decorator for sync functions with exponential backoff@retry_async: Decorator for async functions with exponential backoffCircuitBreaker: Prevent cascading failures with circuit breaker patternBenefits
Usage Examples
Testing
Impact