refactor(errors): defer mutation errors to global handler

Now that MutationCache toasts via toUserMessage by default, the per-hook
onError duplicates drop away. Also normalizes inline query-error UI and
surfaces a previously-silent failure.

Mutations — removed redundant onError toasts:
- network-selector: useAcceptInvitation, createNetwork (inline)
- network-settings: useInviteMembers, useRevokeInvitation, useRemoveMember
- network-billing: useCreateCheckoutSession, useCreatePortalSession
  (onSuccess toasts stay — they carry domain context like network name)

Queries — consistent inline error UX via toUserMessage:
- network-selector: failed-to-load state gets a "Try again" button
- network-billing: "Couldn't load billing" includes friendly reason
- network-settings: useNetworkInvitations failure now surfaces a hint
  (previously rendered as "0 pending" — silently wrong)

Trimmed noisy JSDoc from PR 1 files (errors.ts, query-client.ts,
app-error-boundary.tsx, error-fallback.tsx, ipc-utils.ts).
This commit is contained in:
Claude
2026-04-17 02:52:45 +00:00
parent c00a7a439a
commit 8632c98725
8 changed files with 29 additions and 70 deletions
+2 -3
View File
@@ -6,9 +6,8 @@ type InvokeHandler = (
) => Promise<unknown> | unknown;
/**
* Wraps `ipcMain.handle` so handler failures log the full stack in the main
* process and re-throw a sanitized message to the renderer. Without this,
* main-process exceptions silently reject the renderer promise with no trace.
* Wraps `ipcMain.handle` so handler failures log with full stack in main and
* re-throw a sanitized message to the renderer.
*/
export function safeHandle(channel: string, handler: InvokeHandler): void {
ipcMain.handle(channel, async (event, ...args) => {