mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 03:45:53 -05:00
12 lines
335 B
TypeScript
12 lines
335 B
TypeScript
/** 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;
|
|
}
|
|
}
|