mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
* 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
14 lines
405 B
TypeScript
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;
|
|
});
|
|
}
|
|
}
|