Skip to content

[audit] error-handling: Fire-and-forget async calls in useFileShortcuts.ts lack .catch() #323

@claude

Description

@claude

Problem

File: src/hooks/useFileShortcuts.ts, lines 126 and 136

// Line 126
handleSaveAs(windowLabel);  // returns Promise, no await or .catch()

// Line 136
handleSave(windowLabel);    // returns Promise, no await or .catch()

Both handleSaveAs and handleSave are async functions that return Promises, but they're called without await, void, or .catch() inside a synchronous keydown event handler. Any rejection from these functions (e.g., Tauri invoke failure, filesystem error) becomes an unhandled promise rejection.

This is particularly dangerous because handleSaveAs calls moveTabToNewWorkspaceWindow which can close the current tab/window — if the async chain fails partway through, the user gets no feedback.

Impact

Suggested Fix

void handleSaveAs(windowLabel).catch((e) => 
  console.error("[FileOps] Save As failed:", e)
);

void handleSave(windowLabel).catch((e) => 
  console.error("[FileOps] Save failed:", e)
);

Or better, show a toast notification on failure so the user knows their save didn't complete.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditCodebase audit findingbugSomething isn't workingerror-handlingError handling gap

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions