feat: timeout error-target fetch and fall back to error-path#648
Open
kaddynator wants to merge 4 commits into
Open
feat: timeout error-target fetch and fall back to error-path#648kaddynator wants to merge 4 commits into
kaddynator wants to merge 4 commits into
Conversation
minrk
reviewed
Jul 7, 2026
| if (eto === undefined || eto === null) { | ||
| eto = 10000; | ||
| } | ||
| this.errorTargetTimeout = typeof eto === "string" ? parseInt(eto, 10) : Number(eto); |
Member
There was a problem hiding this comment.
at this point, timeout should be an int, no need to handle the string here
There was a problem hiding this comment.
Addressed in 2fc0b9a. Thanks for the review!
| eto = 10000; | ||
| } | ||
| this.errorTargetTimeout = typeof eto === "string" ? parseInt(eto, 10) : Number(eto); | ||
| if (!Number.isFinite(this.errorTargetTimeout) || this.errorTargetTimeout < 1) { |
Member
There was a problem hiding this comment.
Let's remove this check. Rather than ignoring invalid values, we should assign what is given. If the value is invalid and leads to an error, an error is the right result.
There was a problem hiding this comment.
Addressed in 2fc0b9a. Thanks for the review!
…or-path-fallback # Conflicts: # package-lock.json
…ty fallback Per review: CLI already coerces --error-target-timeout to an int via commander's parseInt, so no need to re-parse here. Invalid values should error naturally rather than being silently defaulted to 10000.
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.
Problem:
Today you must choose either --error-target or --error-path. If --error-target is set and the request to the custom error server fails (hub down, connection refused, etc.), CHP only returns the generic plain-text response. Static HTML under --error-path is never used in that case.
Change:
Permit both --error-target and --error-path. When --error-target is configured, CHP still tries the custom error URL first. On request error, serve HTML from --error-path using the existing rules ({code}.html, then error.html, else default).
Fix --error-path CLI help: it is a directory of HTML files, not another proto://host server.
Add a test that uses an unreachable errorTarget and asserts responses come from the error-path fixtures.
Backward compatibility:
Using only --error-target or only --error-path behaves as before. If both are set, behavior is: dynamic page when reachable; otherwise file-based fallback.