🧹 [Code Health] Fix empty catch blocks in transfer planner script - #83
🧹 [Code Health] Fix empty catch blocks in transfer planner script#83MarsLuay wants to merge 1 commit into
Conversation
…rimary-sources
Updated the three empty `catch {}` blocks around `new URL(...)` parsing to catch the error, check if it's a `TypeError` (expected for invalid URLs), and rethrow it if it isn't, to avoid masking bugs like SyntaxError or ReferenceError.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🎯 What: Replaced empty
catch {}blocks insource/scripts/planner/discover-transfer-planner-primary-sources.cjswith logic to selectively swallowTypeErrorwhile bubbling up all other errors.💡 Why:
new URL()predictably throwsTypeErroron invalid URL input, which is why the previous empty catch blocks were added. However, completely empty catch blocks are an anti-pattern as they mask unexpected bugs (e.g. typos, reference errors) and make debugging extremely difficult.✅ Verification: Verified syntax correctness using
node -c. Ran the full test suite (npm run test:app) and verified all tests pass without regressions.✨ Result: A safer, more maintainable script that correctly ignores expected URL validation errors without hiding unexpected runtime faults.
PR created automatically by Jules for task 8258355369796263433 started by @MarsLuay