Skip to content

Make execution failures fail loudly: name the executable and exit code in the error Notice#447

Open
nelsonlove wants to merge 1 commit into
twibiral:masterfrom
nelsonlove:improve-error-notices
Open

Make execution failures fail loudly: name the executable and exit code in the error Notice#447
nelsonlove wants to merge 1 commit into
twibiral:masterfrom
nelsonlove:improve-error-notices

Conversation

@nelsonlove

Copy link
Copy Markdown

Summary

When a code block fails to run, the current toast just says "Error!" — and when the failure is "executable not on PATH" (very common on macOS, where GUI apps get the bare launchd PATH without Homebrew), the user gets no hint at what went wrong or how to fix it.

This PR makes NonInteractiveCodeExecutor failures actionable:

  • Exit code 127 / 126 (POSIX: command not found / not executable) → Execute Code: 'sbcl' was not found. Set the full path to the executable in the plugin settings. (10s toast)
  • Other non-zero exits → Execute Code: process exited with code N. See the output below the code block.
  • Spawn error event (e.g. ENOENT when shell: false) → Execute Code: failed to start 'cmd': <message>

Changes

  • handleChildOutput gains an optional trailing cmd?: string param (backwards-compatible; callers that don't pass it get generic wording)
  • Call sites in NonInteractiveCodeExecutor (incl. the gcc compile/execute path), ClingExecutor, and PowerShellOnWindowsExecutor pass the command through

Testing

  • npm run build passes (tsc + esbuild)
  • Manually verified on macOS: a code block whose interpreter is a bare command not on Obsidian's PATH now shows the "was not found — set the full path" toast naming the executable; a block exiting non-zero shows the exit-code toast

🤖 Generated with Claude Code

…Error!'

Co-Authored-By: Claude Fable 5 <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