Skip to content

Commit e8e7335

Browse files
committed
failedRequestHandler -> errorHandler
since it should handle every single error it should fire on each error -> error handler, not only on the last one
1 parent f2fdfe3 commit e8e7335

File tree

1 file changed

+2
-2
lines changed
  • sources/academy/platform/expert_scraping_with_apify/solutions

1 file changed

+2
-2
lines changed

sources/academy/platform/expert_scraping_with_apify/solutions/saving_stats.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ await Stats.initialize();
6363
6464
## Tracking errors {#tracking-errors}
6565
66-
In order to keep track of errors, we must write a new function within the crawler's configuration called **failedRequestHandler**. Passed into this function is an object containing an **Error** object for the error which occurred and the **Request** object, as well as information about the session and proxy which were used for the request.
66+
In order to keep track of errors, we must write a new function within the crawler's configuration called **errorHandler**. Passed into this function is an object containing an **Error** object for the error which occurred and the **Request** object, as well as information about the session and proxy which were used for the request.
6767
6868
```js
6969
const crawler = new CheerioCrawler({
@@ -79,7 +79,7 @@ const crawler = new CheerioCrawler({
7979
maxConcurrency: 50,
8080
requestHandler: router,
8181
// Handle all failed requests
82-
failedRequestHandler: async ({ error, request }) => {
82+
errorHandler: async ({ error, request }) => {
8383
// Add an error for this url to our error tracker
8484
Stats.addError(request.url, error?.message);
8585
},

0 commit comments

Comments
 (0)