1/** Thrown when Playwright's Chromium browser is not installed, with install guidance. */2export class BrowserUnavailableError extends Error {3 /** Always `"BrowserUnavailableError"`. */4 override readonly name = "BrowserUnavailableError";56 /**7 * Builds the error with a fixed install-guidance message.8 * @param options standard error options, e.g. a `cause` to chain the launch failure.9 */10 constructor(options?: ErrorOptions) {11 super(12 "Playwright Chromium is not installed. Run `deno run -A npm:playwright@1.61.1 install chromium` and retry.",13 options,14 );15 }16}1718/**19 * Rethrow a browser launch failure as a {@link BrowserUnavailableError} when the20 * message indicates a missing Chromium install; otherwise rethrow it unchanged.21 */22export function rethrowBrowserLaunchError(error: unknown): never {23 const message = error instanceof Error ? error.message : String(error);24 if (25 /executable doesn't exist|browser executable|playwright install|failed to launch/i.test(message)26 ) {27 throw new BrowserUnavailableError({ cause: error });28 }29 throw error;30}