bootstrap: Use legacy-compatible catch syntax (support older Node)#22979
Conversation
We don't actually support Node older than 10 for successfully bootstrapping an Atom build, but we should support older Node in the system requirements checker script so that we can print useful errors, like ones to tell the user their system's copy of Node is too old! (It was me that introduced this Node 10.0.0 or above-only syntax about a year ago... My mistake. It's as good a time as any to fix it!)
|
The syntax error (#22969) (
Edit: Moved tangentially related fix to #23001. |
7ffe869 to
5339e5d
Compare
|
I split this PR in two, since the changes were technically unrelated/served slightly different purposes... If merging this, please also consider #23001. The current PR makes the version checker run on older Node, which is a good thing IMO, but the version the script checks for hasn't been updated in a long time and is quite outdated. See #23001 to raise the version of Node being checked to something more appropriate. |
catch syntax (support older Node)
|
Thanks for the contribution 🙇🏾 |
Requirements for Contributing a Bug Fix (from template, click to expand)
Identify the Bug
Fixes #22969
Description of the Change
catchsyntax inscript/lib/verify-machine-requirements.jsthat is backward-compatible with older Node (9 and older)catch {}blocks without needing to bind the exception. Older Node requires the exception to be bound, like this:catch (exceptionVarName) {}.Side note:
try/catchblock syntax! (Bootstrap syntax error #22969).Alternate Designs
None.
Possible Drawbacks
Allows the rather outdated Node check to function as written.
The Node version check should be updated... Please consider merging #23001 along with this PR.
Verification Process
script/bootstrapandscript/buildon Node 9 and older.Result: Users with Node older than 10 who run
script/bootstrap(orscript/build) can now get through the earliest part,script/lib/verify-machine-requirements.js, without encountering syntax errors. That means the script can properly do its job of detecting build dependency versions and printing their version numbers... and/or printing warnings or errors if the versions are too old to build Atom.Release Notes
N/A