diff --git a/packages/cli/src/capture/navigateForCapture.test.ts b/packages/cli/src/capture/navigateForCapture.test.ts index 167defa0ab..9e0284982c 100644 --- a/packages/cli/src/capture/navigateForCapture.test.ts +++ b/packages/cli/src/capture/navigateForCapture.test.ts @@ -545,6 +545,17 @@ describe("a proxy that was in the way", () => { ); }); + it("tells a file URL apart from a page when the browser turns it into a download", async () => { + const goto = vi + .fn() + .mockRejectedValue(new Error("net::ERR_ABORTED at https://cdn.example/arabic.woff2")); + await expect( + navigateForCapture({ goto }, "https://cdn.example/arabic.woff2", 120_000), + ).rejects.toThrow( + /cdn\.example stopped loading as a page.*file download such as a font.*assets\/fonts.*net::ERR_ABORTED/, + ); + }); + it("leaves every other failure as it was", async () => { const name = new Error("net::ERR_NAME_NOT_RESOLVED at https://nope.example/"); expect(explainProxyRefusal(name, "https://nope.example/")).toBe(name); diff --git a/packages/cli/src/capture/navigateForCapture.ts b/packages/cli/src/capture/navigateForCapture.ts index 318be38e4b..d6fae78f07 100644 --- a/packages/cli/src/capture/navigateForCapture.ts +++ b/packages/cli/src/capture/navigateForCapture.ts @@ -16,6 +16,8 @@ const PROXY_FAILURES = { `Your network's proxy refused the connection to ${host}. Ask whoever runs it to allow ${host}.`, "net::ERR_PROXY_CONNECTION_FAILED": () => "Could not reach your network's proxy. Check the proxy address and that the proxy is running, or ask whoever runs it.", + "net::ERR_ABORTED": (host: string) => + `${host} stopped loading as a page. This usually means the URL is a file download such as a font, not a web page. Capture a page that uses the file; its fonts are saved to assets/fonts.`, } as const; const PROXY_FAILURE = new RegExp(Object.keys(PROXY_FAILURES).join("|"));