fix: ConfirmDialog silently swallows async errors from onConfirm #47

Closed
opened 2026-05-18 16:02:33 +02:00 by Anexim · 3 comments
Owner

Severity: Major

File: src/components/game/ConfirmDialog.tsx (lines 102-112)

Problem: The handleConfirm function catches errors in a finally block but doesn't display them to the user. If onConfirm() throws, the dialog closes silently with no feedback that the action failed.

Impact: Users get no feedback when confirm actions fail. They may think an action succeeded when it actually failed.

Fix: Add error state and display it in the dialog:

const [error, setError] = useState<string | null>(null);
// In handleConfirm:
try {
  await onConfirm();
  onClose();
} catch (e) {
  setError(e instanceof Error ? e.message : 'Action failed');
}
**Severity:** Major **File:** `src/components/game/ConfirmDialog.tsx` (lines 102-112) **Problem:** The `handleConfirm` function catches errors in a `finally` block but doesn't display them to the user. If `onConfirm()` throws, the dialog closes silently with no feedback that the action failed. **Impact:** Users get no feedback when confirm actions fail. They may think an action succeeded when it actually failed. **Fix:** Add error state and display it in the dialog: ```ts const [error, setError] = useState<string | null>(null); // In handleConfirm: try { await onConfirm(); onClose(); } catch (e) { setError(e instanceof Error ? e.message : 'Action failed'); } ```
Anexim added the ai:todo label 2026-05-18 16:02:33 +02:00
n8n-gitea was assigned by Anexim 2026-05-18 16:02:33 +02:00
Author
Owner

[priority: 4] BROKEN FEATURE — ConfirmDialog silently swallows async errors from onConfirm.

[priority: 4] BROKEN FEATURE — ConfirmDialog silently swallows async errors from onConfirm.
Author
Owner

Starting work on #47. Reading ConfirmDialog.tsx to fix async error swallowing.

Starting work on #47. Reading ConfirmDialog.tsx to fix async error swallowing.
Author
Owner

Fixed. Added error state to ConfirmDialog. The handleConfirm function now catches errors from onConfirm() and displays them in a red error box inside the dialog instead of silently swallowing them. The dialog stays open when an error occurs so the user can see the failure message.

Fixed. Added error state to ConfirmDialog. The handleConfirm function now catches errors from onConfirm() and displays them in a red error box inside the dialog instead of silently swallowing them. The dialog stays open when an error occurs so the user can see the failure message.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Anexim/Mana-Loop#47