fix(sources): handle streaming request errors - #1533
Conversation
bepri
left a comment
There was a problem hiding this comment.
Thanks, @gcomneno. Checked this out locally and it seems good! Undoing your change in base.py breaks the unit test as I'd expect.
Would you mind adding a change log entry for this as well? You can assume it'll be part of the next patch release and put a placeholder like "Unreleased" for the date and we'll just update it once we know more about the next date/version.
|
Thanks, Imani — done. I added a changelog entry under |
|
I checked the current CI failures. The The Could someone please rerun the failed jobs when convenient? |
|
I checked the current CI failures. The The Could someone please rerun the failed jobs when convenient? |
3b29cf9 to
163fb09
Compare
|
Hi! Just gently following up on this one. This PR is approved, and the current remaining blockers look CI-related rather than code review feedback:
Could someone please rerun the failed jobs when convenient? Happy to adjust anything if I missed a code-related failure. |
|
@gcomneno I've merged the latest and approved test runs — we have a |
There was a problem hiding this comment.
Pull request overview
This PR improves file-source download error handling by ensuring exceptions raised during streaming downloads surface as source-facing NetworkRequestError rather than raw requests exceptions.
Changes:
- Move the streaming download (
url_utils.download_request(...)) into the request exception-handling block so streaming failures are wrapped consistently. - Add a unit test covering a streaming
ChunkedEncodingErrorduring URL pulls. - Document the fix in the unreleased changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
craft_parts/sources/base.py |
Wraps streaming download exceptions into NetworkRequestError by moving the streaming call inside the existing try/except. |
tests/unit/sources/test_base.py |
Adds a unit test to assert streaming request exceptions are raised as NetworkRequestError. |
docs/reference/changelog.rst |
Adds an unreleased changelog entry documenting the bug fix. |
…file-source-request-errors # Conflicts: # craft_parts/sources/base.py
Summary
Wrap request exceptions raised while streaming file source downloads into
NetworkRequestError, so file source failures surface as source-facing errors instead of rawrequestsexceptions.Testing
pytest -q tests/unit/sources/test_base.py -rsIssue
Closes #1396