Can't mark request as failed
Hello,
I am trying to mark a request as failed using crawlee + playwright.
I tried multiple things, from throwing exceptions to use
request.pushErrorMessage()
method. The session.retire()
is working for marking the session as bad, but not for mark the request as failed:
With the previous code, I get
Terminal status message: Finished! Total 1 requests: 1 succeeded, 0 failed.
When I expect it to fail and retry
Throwing directly an exception also does not work
new Error("Captcha detected")
There is a similar issue solved using Apify actor, but in this case I do not have access to it as I am using vanila Crawlee
https://discord.com/channels/801163717915574323/1105228219013140480/11158698642681528524 Replies
national-gold•2y ago
You could do something like
request.noRetry = true;
and then throw after it. If you just throw - request will be retried (3 times by default). This will show request as failed one in the status messagelike-goldOP•2y ago
Even throwing an exception I still see
Terminal status message: Finished! Total 1 requests: 1 succeeded, 0 failed.
The only time where It is retrying and I see failed requests is when I have a timeout or the website returns and 403 forbidden. But in my case it is returning an 200 OK but with a captcha and I want to mark this request as failed and retry it.@HelThunk just advanced to level 1! Thanks for your contributions! 🎉
national-gold•2y ago
just throwing an error inside requestHandler will lead to further retry. Retrying 3 times will mark requests as failed and it will be reflected in the status message. I just tried it to double-checked