Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

498 B
Raw Blame
/**
 * Apply a pick, then close — or, if applying it failed, stay open and say so.
 * Closing first would make a failed save look like a pick that took, with the
 * old folder still in use and nothing to retry from.
 */
export const confirmPick = async ({
  apply,
  close,
  fail,
}: {
  apply: () => void | Promise<void>;
  close: () => void;
  fail: (error: unknown) => void;
}): Promise<void> => {
  try {
    await apply();
  } catch (error) {
    fail(error);
    return;
  }
  close();
};