Skip to content

fix: handle EEXIST error in build script#4

Closed
glovergao wants to merge 2 commits into
freecodexyz:mainfrom
emore-inc:main
Closed

fix: handle EEXIST error in build script#4
glovergao wants to merge 2 commits into
freecodexyz:mainfrom
emore-inc:main

Conversation

@glovergao

@glovergao glovergao commented Apr 1, 2026

Copy link
Copy Markdown

Bun's mkdirSync throws EEXIST when the directory already exists, unlike Node.js which ignores it. Add try-catch to handle this case.

Summary by CodeRabbit

  • Chores
    • Improved build process robustness by enhancing error handling for directory creation, allowing builds to continue when directories already exist while properly handling other failure scenarios.

Bun's mkdirSync throws EEXIST when the directory already exists,
unlike Node.js which ignores it. Add try-catch to handle this case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 1, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f44449f0-9999-4673-a50d-33e426be2e98

📥 Commits

Reviewing files that changed from the base of the PR and between e12181548ebdab91617ede8f5d25c64aff2cd4ab and 02f27c3.

📒 Files selected for processing (1)
  • scripts/build.ts
✅ Files skipped from review due to trivial changes (1)
  • scripts/build.ts

📝 Walkthrough

Walkthrough

The build script now wraps directory creation in a try/catch block to gracefully handle cases where the directory already exists (EEXIST), allowing the build to continue while re-throwing other errors.

Changes

Cohort / File(s) Summary
Directory Creation Error Handling
scripts/build.ts
Added try/catch block around mkdirSync() to gracefully handle EEXIST errors when directory already exists, while re-throwing other errors.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A directory once blocked our way,
"Already here!" we'd hear it say,
But now with catch, we skip and run,
The build marches on—the deed is done!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding error handling for EEXIST in the build script, which is the primary purpose of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/build.ts`:
- Around line 122-126: The catch is too broad in the mkdirSync(dirname(outfile),
{ recursive: true }) call and currently swallows all errors; change the catch to
capture the error (e.g., catch (err)) and rethrow unless err.code === 'EEXIST'
so only the "directory exists" error is ignored; reference the mkdirSync call,
dirname(outfile), and its catch block when making this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0925f598-91f4-4b8f-9aa0-4023ec9cd953

📥 Commits

Reviewing files that changed from the base of the PR and between e5b13b3 and 9c1a845.

📒 Files selected for processing (1)
  • scripts/build.ts

Comment thread scripts/build.ts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@glovergao glovergao closed this Apr 1, 2026
MicoinSmith added a commit to MicoinSmith/free-code that referenced this pull request Jun 20, 2026
…e, Chinese prompts

P0 freecodexyz#1: /cd command — switch working directory without exiting session
P0 freecodexyz#2: --safe-mode flag — disable write/execute tools for troubleshooting
P0 freecodexyz#3: Parallel tool call resilience — Bash errors no longer cancel siblings
P0 freecodexyz#4: Auto mode classifier prompts — bilingual Chinese/English support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant