Skip to content

Commit c80e963

Browse files
committed
Add info about errorHandler
1 parent 0b13551 commit c80e963

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

content/academy/expert_scraping_with_apify/saving_useful_stats.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Before moving on, give these valuable resources a quick lookover:
1818

1919
- Refamiliarize with the various available data on the [Request object](https://crawlee.dev/api/core/class/Request).
2020
- Learn about the [`failedRequestHandler` function](https://crawlee.dev/api/browser-crawler/interface/BrowserCrawlerOptions#failedRequestHandler).
21+
- Understand how to use the [`errorHandler`](https://crawlee.dev/api/browser-crawler/interface/BrowserCrawlerOptions#errorHandler) function to handle request failures.
2122
- Ensure you are comfortable using [key-value stores](https://sdk.apify.com/docs/guides/data-storage#key-value-store) and [datasets](https://sdk.apify.com/docs/api/dataset#__docusaurus), and understand the differences between the two storage types.
2223

2324
## [](#quiz) Knowledge check 📝
@@ -26,6 +27,7 @@ Before moving on, give these valuable resources a quick lookover:
2627
2. In our Amazon scraper, we are trying to store the number of retries of a request once its data is pushed to the dataset. Where would you get this information? Where would you store it?
2728
3. We are building a new imaginary scraper for a website that sometimes displays captchas at unexpected times, rather than displaying the content we want. How would you keep a count of the total number of captchas hit for the entire run? Where would you store this data? Why?
2829
4. Is storing these types of values necessary for every single actor?
30+
5. What is the difference between the `failedRequestHandler` and `errorHandler`?
2931

3032
## Our task
3133

content/academy/expert_scraping_with_apify/solutions/saving_stats.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,7 @@ router.addHandler(labels.OFFERS, async ({ $, request }) => {
158158
**Q: Is storing these types of values necessary for every single actor?**
159159
160160
**A:** For small actors, it might be a waste of time to do this. For large-scale actors, it can be extremely helpful when debugging and most definitely worth the extra 10-20 minutes of development time. Usually though, the default statistics from the Crawlee and the SDK might be enough for simple run stats.
161+
162+
**Q: What is the difference between the `failedRequestHandler` and `errorHandler`?**
163+
164+
**A:** `failedRequestHandler` runs after a request has failed and reached it's `maxRetries` count. `errorHandler` runs on every failure and retry.

0 commit comments

Comments
 (0)