Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created November 30, 2024 16:37
Show Gist options
  • Save johnlindquist/fcef428a0197b4e48e2e0b530b1e03e2 to your computer and use it in GitHub Desktop.
Save johnlindquist/fcef428a0197b4e48e2e0b530b1e03e2 to your computer and use it in GitHub Desktop.
// Name: Testing Restart Prompt
import { Action } from "@johnlindquist/kit";
let errorCount = 0;
let error = true;
while (error) {
error = false;
try {
throw new Error();
} catch (e) {
type options = "retry" | "ignore";
const choice: options = await arg(`Errored, restarting... ${errorCount}`, [
"retry",
"ignore",
] as options[]);
if (choice === "retry") {
error = true;
errorCount++;
continue;
}
}
}
await div("done");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment