-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: add error handling and logging to get_camera_video() #326
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request introduces modifications to the Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (2)src/uiprotect/api.py (2)
The addition of debug logging before making the request is helpful for troubleshooting failed requests. The log message includes all necessary context: API path, endpoint, and parameters.
The implementation of error handling using
This change aligns perfectly with the PR objectives of improving error visibility. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
|
Description of change
This PR does 2 things:
get_camera_video()
requests: Today inget_camera_video()
, if the protect server returns any status code other than 200, the client will happily returnNone
without indicating anything went wrong. This PR uses theraise_for_status()
pattern found in the rest of this file to raise an error when the protect server returns an irregular status code, providing better visibility for both the CLI and API interfaces.get_camera_video()
requests: This PR adds additional request logging to theget_camera_video()
function, which can be used to help debug requests that fail. The log level is set toDEBUG
.This has been discussed in home-assistant/core#132524.
Pull-Request Checklist
main
branchFixes #0000
n/aSummary by CodeRabbit
New Features
Bug Fixes
Documentation