Commit 652fb79
authored
fix: add error parameters to Lychee action to catch blocks for Node.js compatibility (#1547)
## Description
This PR fixes a potential syntax error in the link checker script that
was causing issues in [GitHub Actions run
#17112743303](https://github.com/wandb/docs/actions/runs/17112743303/job/48537533886#step:7:32).
## Problem
The `fix_broken_links.mjs` script was using optional catch binding
syntax (`catch {}` without an error parameter), which might not be
supported in all Node.js environments or could be causing parsing issues
in the GitHub Actions runner.
## Solution
Updated all catch blocks to include the error parameter:
- `catch {}` → `catch (e) {}`
This ensures compatibility across different Node.js versions and
environments.
## Changes
- Updated 4 catch blocks in `fix_broken_links.mjs`:
- Line 32: `normalizeUrl` function
- Line 115: Controller cleanup in `probeRedirect`
- Line 146: URL parsing in `candidateVariants`
- Line 231: URL manipulation in `generateFromCandidates`
## Testing
The updated code maintains the same functionality while being more
compatible with different JavaScript environments. The error parameter
is added but not used (as was the original intent with optional catch
binding).1 parent ecf4db2 commit 652fb79
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
0 commit comments