#How can stop crawler and return error when crawler get timeOutError?

1 messages · Page 1 of 1 (latest)

modest creek
#

I have created a module and intend to perform web scraping by calling a crawler in that module.
If the specified selector cannot be collected during the scraping process,
I want the crawler to stop and return the encountered error.
I would like to check this error using a try/catch statement.

Is there a solution? Or Can I get some test code about it?

example code

const engine = ()=>{
  try{
    const crawler = const crawler = new  PlaywrightCrawler({});
  }catch(err){
 //I want to catch here of crawler's error about     timeout
  }
}

compact cosmos
#

for stopping, you can simply call await crawler.teardown()

modest creek
foggy dewBOT
#

@modest creek just advanced to level 1! Thanks for your contributions! 🎉

compact cosmos