Repository navigation
fix(scrape): improve error handling and response propagation for scraping failures - #118
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Scraping failures reported by the core engine (
success=False— e.g. HTTP 4xx/5xx responses, connection errors, robots.txt blocks, browser timeouts) were previously surfaced as successful operations:ScrapeServicereturnedsuccess=True, the API answered HTTP 200 withsuccess=true, the CLI could exit with code 0, and batches counted failed URLs as successes (leavingerror=Nonewhen the whole batch failed).This PR fixes the core/service boundary so engine failures propagate correctly:
_scrape_static()and_scrape_dynamic()inspect the core result and raiseExecutionError(withurl/status_codedetails) when the engine reports failure; already-contextualizedExecutionErrors are re-raised instead of being wrapped again.scrape_multiple()classifies individual failures as failures (warnings include the reason), and a fully failed batch returns an aggregateerrorwitherror_code=SCRAPE_ERROR.HTTPExceptions (except HTTPException: raise), so error details stay clean; real failures return HTTP 500 instead of HTTP 200 withsuccess=true.scrape batchcommand prints failure warnings on partial batches.status_code=200metadata.quick_serviceneeded no code change: with the service fix it logs the real reason (e.g.Scrape failed: HTTP 404) and no longer incorporates failed scrapes into the report.Related Issue
None.
Type of Change
Checklist
Screenshots (if applicable)
Not applicable.