Repository navigation
fix(nodeenv): report the url and proxy instead of a traceback - #410
Merged
Merged
Conversation
A download that never reaches a server, which a broken http_proxy or https_proxy usually causes, raised URLError all the way out of main(). The user got a stack trace naming neither the url nodeenv tried nor the proxy it went through. urlopen() now catches URLError, logs the url with the failure reason and the proxy variables that are set, and exits 1. HTTPError is re-raised untouched: it is a URLError subclass, and download_node_src() relies on it for the arm64 to x64 fallback. Closes #229
ekalinin
force-pushed
the
fix/proxy-error-message
branch
from
September 21, 2026 18:28
933d6f9 to
bfcc27c
Compare
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.
Closes #229.
Problem
A download that never reaches a server raises
URLErrorall the way out ofmain(). The user gets a stack trace that names neither the url nodeenv tried nor the proxy it went through. A brokenhttp_proxy/https_proxyis the usual cause, which is exactly what #229 reported.Still reproducible on current master:
Fix
urlopen()now catchesURLError, logs the url with the failure reason and whatever proxy variables are set, and exits 1:The SSL-context branching moved into
_urlopen(req)so the new handler wraps all three variants at once. Since every download goes throughurlopen(), this covers all four call sites:download_node_src(), the two npm paths andindex.json.HTTPErroris re-raised untouched. It is aURLErrorsubclass, so a plainexcept URLErrorwould have swallowed every 404 as well and silently broken the arm64 to x64 fallback indownload_node_src().Tests
test_urlopen_reports_the_url_it_failed_to_reachtest_urlopen_reports_the_proxy_it_went_throughtest_urlopen_keeps_raising_http_errors, a regression guard for the arm64 fallbackAlso checked by hand: the unresolvable-proxy-host variant from the report, that no environment directory is left behind, and that a normal
--listis unaffected.