Skip to content

fix: reorder systemInfo logging after error stack#8268

Closed
hrishikesh-k wants to merge 1 commit into
mainfrom
hk/log-error-before-system-info
Closed

fix: reorder systemInfo logging after error stack#8268
hrishikesh-k wants to merge 1 commit into
mainfrom
hk/log-error-before-system-info

Conversation

@hrishikesh-k
Copy link
Copy Markdown
Contributor

🎉 Thanks for submitting a pull request! 🎉

Summary

For cases like these: https://answers.netlify.com/t/157384/

The CLI was quitting without any error message - most likely because the systemInfo() async call didn't finish (in time). With this change, we'd at least always see the error message which could lead to some debugging other than everyone being lost on what the actual error is.

@hrishikesh-k hrishikesh-k requested a review from a team as a code owner May 20, 2026 18:49
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved error stack trace visibility by logging error details earlier in the exception handling process.

Walkthrough

The uncaught-exception handler in the CLI entry point reorders its logging sequence: the error stack (err.stack / err) is now logged before awaiting the getSystemInfo() call. The system info output and subsequent error reporting behavior remain unchanged. This ensures the error message appears in output before system diagnostics are retrieved.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: reordering systemInfo logging to occur after error stack logging.
Description check ✅ Passed The description clearly explains the issue being fixed and the rationale for the change, relating directly to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hk/log-error-before-system-info

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

@github-actions
Copy link
Copy Markdown

📊 Benchmark results

Comparing with dfcc0a2

  • Dependency count: 1,134 (no change)
  • Package size: 379 MB (no change)
  • Number of ts-expect-error directives: 355 (no change)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/main.ts`:
- Around line 99-101: The uncaughtException handler calls getSystemInfo() (which
uses envinfo.run and may reject) without safeguards, so wrap the system info
retrieval in a try-catch-finally inside the uncaughtException handler: call
getSystemInfo() inside try and log its output if successful, catch any error
from envinfo.run and log or ignore it, then ensure reportError(err, { severity:
'error' }) is invoked and process.exit(1) is always called in finally; reference
the getSystemInfo function, envinfo.run internals, the existing reportError
call, and the process.exit(1) to locate where to add the try-catch-finally.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a4d1cfc3-ff7c-4fad-a23d-4ca5f94bbb3c

📥 Commits

Reviewing files that changed from the base of the PR and between dfcc0a2 and 676a09c.

📒 Files selected for processing (1)
  • src/commands/main.ts

Comment thread src/commands/main.ts
@hrishikesh-k
Copy link
Copy Markdown
Contributor Author

New PR: #8269

@hrishikesh-k hrishikesh-k deleted the hk/log-error-before-system-info branch May 20, 2026 19:07
hrishikesh-k added a commit that referenced this pull request May 21, 2026
🎉 Thanks for submitting a pull request! 🎉

#### Summary

Next iteration of: #8268. This PR
should fix the original issue of the CLI ending in a loop. It should
exit as soon as the error is triggered.
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