You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only HTTPError is caught in make_cfapi_request, so other RequestExceptions (e.g., timeouts or connection errors) will propagate uncaught. Consider catching broader exceptions like RequestException.
is_github_app_installed_on_repo uses strict equality on response.text to "true", which may fail if the API returns extra whitespace or formatting. Consider normalizing the response text (e.g., strip(), lower()) before comparison.
Broaden the exception catch to include all request-related errors and capture the exception instance. This ensures connection issues and timeouts are also logged instead of slipping through.
-except requests.exceptions.HTTPError:+except requests.exceptions.RequestException as e:
Suggestion importance[1-10]: 8
__
Why: Using RequestException catches all request-related errors (e.g., timeouts, connection issues) and capturing the exception instance ensures proper logging and avoids uncaught cases.
Medium
General
Log HTTP status code
Include the HTTP status code in the error log to aid debugging and quickly identify the type of failure.
-logger.error(f"Error making request to Codeflash API: {error_message}")+logger.error(f"Error making request to Codeflash API (status {response.status_code}): {error_message}")
Suggestion importance[1-10]: 6
__
Why: Including response.status_code in the error log provides valuable context for debugging API failures without altering logic.
Low
Log failure in install check
Restore logging on failure to help diagnose why the GitHub App check is false by logging status and response text.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
PR Type
Bug fix, Enhancement
Description
Wrap API calls in try/except for HTTPError
Log JSON or string error messages from API
Use response.raise_for_status on requests
Simplify GitHub app install check logic
Changes walkthrough 📝
cfapi.py
Enhance error handling and loggingcodeflash/api/cfapi.py