From fd305c5e0ffcd9dee2bd79974674246c0af5acc8 Mon Sep 17 00:00:00 2001 From: Michal Oblak Date: Tue, 3 Mar 2026 11:11:27 +0100 Subject: [PATCH 1/2] Better browser login errors --- src/web2cli/auth/browser_login.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/web2cli/auth/browser_login.py b/src/web2cli/auth/browser_login.py index 52607fc..ce64954 100644 --- a/src/web2cli/auth/browser_login.py +++ b/src/web2cli/auth/browser_login.py @@ -91,6 +91,7 @@ def _is_missing_browser_error(exc: Exception) -> bool: "executable doesn't exist" in text or "chromium distribution 'chrome'" in text or "cannot find chromium" in text + or "download new browsers" in text or ("playwright install" in text and "chromium" in text) ) @@ -783,7 +784,17 @@ def capture_auth_with_browser( raise BrowserLoginCancelled("Login cancelled by user") except Exception as e: if _is_missing_browser_error(e): - _install_chromium(status_cb) + try: + _install_chromium(status_cb) + except Exception as install_error: + raise BrowserLoginError( + "Browser engine is missing and automatic install failed.\n" + "Try manual setup:\n" + f" {sys.executable} -m playwright install chromium\n" + "Then verify with:\n" + " web2cli doctor browser --deep\n" + f"Install error: {install_error}" + ) try: return asyncio.run( _capture_auth_once( From 31e9cd2b008e64e1dba46dfd656d8a07bcc1e172 Mon Sep 17 00:00:00 2001 From: Michal Oblak Date: Tue, 3 Mar 2026 13:31:55 +0100 Subject: [PATCH 2/2] Change how much space does chromium really takes --- src/web2cli/auth/browser_login.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web2cli/auth/browser_login.py b/src/web2cli/auth/browser_login.py index ce64954..cfb2048 100644 --- a/src/web2cli/auth/browser_login.py +++ b/src/web2cli/auth/browser_login.py @@ -97,7 +97,7 @@ def _is_missing_browser_error(exc: Exception) -> bool: def _install_chromium(status_cb: Callable[[str], None] | None) -> None: - _emit(status_cb, "Installing browser engine (one-time, ~50MB)...") + _emit(status_cb, "Installing browser engine (one-time, ~250MB)...") _run_command([sys.executable, "-m", "playwright", "install", "chromium"])