-
Notifications
You must be signed in to change notification settings - Fork 121
core: services: helper: Fix binary output #3775
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
core: services: helper: Fix binary output #3775
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefines error handling in simple_http_request to distinguish JSON decoding errors from HTTP/socket errors, adding more informative logging and error messages for JSON failures while preserving existing handling for other exceptions. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `core/services/helper/main.py:264-266` </location>
<code_context>
request_response.error = str(e)
- except (http.client.HTTPException, socket.error, json.JSONDecodeError) as e:
+ except json.JSONDecodeError as e:
+ logger.warning(f"Failed to decode JSON response: {e.msg} (pos {e.pos})")
+ request_response.error = e.msg
+
+ except (http.client.HTTPException, socket.error) as e:
</code_context>
<issue_to_address>
**suggestion:** Consider using str(e) (or including pos) for the stored error to preserve full JSONDecodeError context
Using `str(e)` for `JSONDecodeError` preserves useful details like line/column/char (e.g. `Expecting value: line 1 column 1 (char 0)`), which are lost when using only `e.msg`. Since the log already includes position, consider keeping `request_response.error` consistent with previous behavior and other exceptions by using `str(e)` or including position explicitly (e.g. `f"{e.msg} (pos {e.pos})"`).
```suggestion
except json.JSONDecodeError as e:
logger.warning(f"Failed to decode JSON response: {e.msg} (pos {e.pos})")
request_response.error = str(e)
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
fa25c3b to
9edf83f
Compare
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
9edf83f to
c8c7f98
Compare
Summary by Sourcery
Bug Fixes: