Add exit code differentiation for external vs internal crawl errors#51
Merged
YusukeHirao merged 4 commits intomainfrom Mar 9, 2026
Merged
Add exit code differentiation for external vs internal crawl errors#51YusukeHirao merged 4 commits intomainfrom
YusukeHirao merged 4 commits intomainfrom
Conversation
Distinguish between fatal errors (exit 1) and warnings (exit 2) so that external link failures (DNS, certificate expiry) no longer fail CI when the crawl itself succeeded. - Add exit code constants: Success(0), Fatal(1), Warning(2) - Classify CrawlerError with isExternal flag in crawler package - CrawlAggregateError.hasOnlyExternalErrors for error classification - Add --strict flag to crawl/pipeline to treat external errors as fatal - Add global error handler in CLI entry point - Improved error summary output (internal/external breakdown) Closes #36 https://claude.ai/code/session_01HtVd24jAUKYMjuMu1wgJs4
- Strengthen isCrawlerExternalError type guard with pid check - Include internal/external breakdown in CrawlAggregateError.message - Add tests: empty array edge case, message format, formatCrawlErrors output - Add test: resumeCrawl exit code path for external errors - Replace magic number 1 with ExitCode.Fatal in pipeline test https://claude.ai/code/session_01HtVd24jAUKYMjuMu1wgJs4
- README: add --strict to crawl options table - README: add exit code table with CI usage examples - README: mention --strict in pipeline options - ARCHITECTURE: add CLI exit code section with error classification flow https://claude.ai/code/session_01HtVd24jAUKYMjuMu1wgJs4
README: Add pipeline-specific CI examples with --strict and exit code cross-reference to the crawl section. ARCHITECTURE: Clarify that both crawl and pipeline commands share the same exit code behavior. https://claude.ai/code/session_01HtVd24jAUKYMjuMu1wgJs4
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.
Summary
This PR introduces differentiated exit codes for the
crawlandpipelinecommands to distinguish between fatal errors (exit code 1) and non-fatal external link errors (exit code 2). It also adds a--strictflag to treat external link errors as fatal when needed.closes: #36
Key Changes
New exit code system: Created
ExitCodeenum with three states:0(Success): No errors1(Fatal): Internal errors or missing arguments2(Warning): External link errors only (DNS failures, certificate errors, etc.)Enhanced
CrawlAggregateError:hasOnlyExternalErrorsproperty to distinguish error typesisCrawlerExternalError()type guard to classify errorsNew
--strictflag:crawlandpipelinecommandsError handling in pipeline:
CrawlAggregateErrorwith only external errors--strictis specifiedUpdated
CrawlerErrortype: AddedisExternalfield to distinguish between external and internal errors at the crawler levelGlobal error handler: Added try-catch in main CLI entry point to format and handle uncaught errors consistently
Implementation Details
CrawlerError.isExternalfield; plainErrorobjects are treated as internal--strictflag is passed through the entire pipeline from CLI flags to the crawl commandhttps://claude.ai/code/session_01HtVd24jAUKYMjuMu1wgJs4