Files
hyperframes/packages/cli/src/utils/screenshotOnceMore.ts
T
Miguel Ángel ada71da92d fix(cli): capture takes a refused screenshot once more before naming it (#7222)
* fix(cli): capture takes a refused screenshot once more before naming it

* fix(cli): keep the screenshot retry's doc to one line

* test(cli): refuse the same capture shot twice now that one refusal is retried
2026-11-05 08:19:17 +00:00

14 lines
405 B
TypeScript

import { isTransientBrowserError } from "@hyperframes/engine";
/** Retries once on a passing Chrome refusal; a second failure rethrows the first error. */
export async function screenshotOnceMore<T>(shoot: () => Promise<T>): Promise<T> {
try {
return await shoot();
} catch (err) {
if (!isTransientBrowserError(err)) throw err;
return shoot().catch(() => {
throw err;
});
}
}