From 9b92924f00e697fccc0f8ae065239ae9da92148f Mon Sep 17 00:00:00 2001 From: Felipe Date: Mon, 10 Mar 2025 22:27:19 -0300 Subject: [PATCH] Perform the error handling for `raise_request_on_failer` before waiting for selectors --- lib/grover/js/processor.cjs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/grover/js/processor.cjs b/lib/grover/js/processor.cjs index 358851a..b1956e9 100644 --- a/lib/grover/js/processor.cjs +++ b/lib/grover/js/processor.cjs @@ -239,6 +239,15 @@ const _processPage = (async (convertAction, uriOrHtml, options) => { await page.goto(displayUrl || 'http://example.com', requestOptions); } + // Check for request errors immediately after navigation + if (requestErrors.length > 0) { + throw new GroverError("RequestFailedError", requestErrors); + } + + if (pageErrors.length > 0) { + throw new GroverError("PageRenderError", pageErrors); + } + // add styles (if provided) const styleTagOptions = options.styleTagOptions; delete options.styleTagOptions; if (Array.isArray(styleTagOptions)) {