Skip to content

fix(cli): catch output directory creation errors in render#130

Closed
miguel-heygen wants to merge 1 commit into03-29-fix_cli_distinguish_info_vs_warning_severity_in_lint_outputfrom
03-29-fix_cli_catch_output_directory_creation_errors_in_render
Closed

fix(cli): catch output directory creation errors in render#130
miguel-heygen wants to merge 1 commit into03-29-fix_cli_distinguish_info_vs_warning_severity_in_lint_outputfrom
03-29-fix_cli_catch_output_directory_creation_errors_in_render

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen commented Mar 29, 2026

Summary

  • mkdirSync for the render output path was not wrapped in try-catch
  • When the path was invalid or permissions were denied, Node.js threw a raw EACCES error with full stack trace
  • Now catches the error and displays a clean error box via the existing errorBox helper

Reproducer

npx hyperframes render --output /root/nope/output.mp4
# Was: raw "Error: EACCES: permission denied, mkdir '/root/nope'"
#   at Object.mkdirSync (node:fs:1379:3)
#   at ...12 lines of stack trace...
# Now: clean "Cannot create output directory" error box

Stack

7/8 in the HyperFrames new-user bug fixes stack.

🤖 Generated with Claude Code

@miguel-heygen miguel-heygen marked this pull request as ready for review March 29, 2026 11:38
@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_catch_output_directory_creation_errors_in_render branch from 1704c30 to 898d7c4 Compare March 29, 2026 11:39
Copy link
Copy Markdown
Collaborator Author

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

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

errorBox parameter semantics are swapped

The errorBox signature is errorBox(title, hint?, suggestion?) where hint is rendered dimmed (informational) and suggestion is rendered accented (actionable command). Every other call site in this file follows that convention.

The current call passes the directory path as hint and the raw OS error as suggestion, which means the error message (e.g. "EACCES: permission denied") gets styled as if it were an actionable command.

Suggest:

errorBox(
  "Cannot create output directory",
  `${dirname(outputPath)}: ${message}`,
  "Check that you have write permission or specify a different path with --output.",
);

Also minor: `${dirname(outputPath)}` is equivalent to just dirname(outputPath) since it already returns a string — the template literal wrapping is unnecessary.

mkdirSync for the render output path was not wrapped in try-catch,
exposing a raw Node.js EACCES stack trace when the path was invalid
or permissions were denied.

Reproducer:
  npx hyperframes render --output /root/nope/output.mp4
  # Was: raw "Error: EACCES: permission denied" with stack trace
  # Now: clean "Cannot create output directory" error box
@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_distinguish_info_vs_warning_severity_in_lint_output branch from d4af810 to 9c93dff Compare March 29, 2026 11:51
@miguel-heygen miguel-heygen force-pushed the 03-29-fix_cli_catch_output_directory_creation_errors_in_render branch from 898d7c4 to 5430f9a Compare March 29, 2026 11:51
Copy link
Copy Markdown
Collaborator Author

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

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

Addressed: fixed errorBox parameter order — error message now in hint slot, actionable suggestion ("Check write permission or use --output") in suggestion slot. Removed unnecessary template literal.

@miguel-heygen
Copy link
Copy Markdown
Collaborator Author

Consolidated into fix/render-improvements.

@miguel-heygen miguel-heygen deleted the 03-29-fix_cli_catch_output_directory_creation_errors_in_render branch April 6, 2026 23:24
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