-
Notifications
You must be signed in to change notification settings - Fork 22
[Chore] Log errors from cf-api for better debugging #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
| else: | ||
| response = requests.get(url, headers=cfapi_headers, timeout=60) | ||
| response.raise_for_status() | ||
| return response # noqa: TRY300 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: whats noqa?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's for ignoring ruff linter for this line.
| response = requests.post(url, data=json_payload, headers=cfapi_headers, timeout=60) | ||
| else: | ||
| response = requests.get(url, headers=cfapi_headers, timeout=60) | ||
| response.raise_for_status() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good.
d71de84 to
57d700b
Compare
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