Files

12 lines
335 B
TypeScript
Raw Permalink Normal View History

2026-10-12 15:16:43 -04:00
/** Runs a mutation whose failure the mutation itself reports, resolving whether it succeeded. */
export async function attempt(mutation: () => Promise<unknown>): Promise<boolean> {
try {
await mutation();
return true;
} catch {
// Error toast is handled by the mutation.
return false;
}
}