Skip to content

Commit 362b813

Browse files
betegonclaude
andauthored
fix(init): match formatError priority order for WizardError message (#981)
## Summary The squash merge for #980 captured the first 3 commits but missed the priority-order fix that came in as a follow-up from a bot review. Main currently has `result.result?.message ?? result.error` but `formatError` (which writes to the terminal) uses the opposite: `result.error ?? inner?.message`. This makes the terminal output and the Sentry exception message inconsistent when both fields are set. ## Changes One-line fix in `handleFinalResult` (`wizard-runner.ts`): swap the operands so the Sentry message uses `result.error ?? result.result?.message`, matching `formatError` exactly. In practice the two fields are mutually exclusive (structured bails populate `result.result.message`; Mastra framework failures populate `result.error`), so there's no user-visible behaviour change — just consistency between what the terminal shows and what Sentry captures. ## Test Plan Existing tests in `wizard-runner-handle-final-result.mocked.test.ts` cover both the `result.error` and `result.result.message` paths and pass unchanged. Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent df7b32d commit 362b813

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/lib/init/wizard-runner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ export function handleFinalResult(
869869
setTag("wizard.exit_code", workflowCode);
870870
}
871871
throw new WizardError(
872-
result.result?.message ?? result.error ?? "Workflow returned an error",
872+
result.error ?? result.result?.message ?? "Workflow returned an error",
873873
{ exitCode }
874874
);
875875
}

0 commit comments

Comments
 (0)