Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Improve error handling in blockRequests()

Ondra Urban9883f28d3017
diff --git a/src/puppeteer_utils.js b/src/puppeteer_utils.js
index 46af3ded1..a1414e0e2 100644
--- a/src/puppeteer_utils.js
+++ b/src/puppeteer_utils.js
@@ -244,6 +244,7 @@ const blockRequests = async (page, options = {}) => {
includeDefaults = true,
} = options;
+ checkParamOrThrow(page, 'options.page', 'Object');
checkParamOrThrow(urlPatterns, 'options.urlPatterns', '[String]');
checkParamOrThrow(includeDefaults, 'options.includeDefaults', 'Boolean');