Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Created November 30, 2024 16:38
Show Gist options
  • Save johnlindquist/b7595ee386264c5a5f452e51ed6ec9ae to your computer and use it in GitHub Desktop.
Save johnlindquist/b7595ee386264c5a5f452e51ed6ec9ae to your computer and use it in GitHub Desktop.
// Name: Testing Restart Prompt
import "@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