ruipgil / scraperjs

A complete and versatile web scraper.
MIT License
3.71k stars 188 forks source link

Please also add error handling example #24

Closed martinsookael closed 8 years ago

martinsookael commented 9 years ago

Hi!

Really like your library. I cannot figure out how to make it handle errors (wrong URL for example). Could you add this somewhere?

Greetings, Martin

ruipgil commented 9 years ago

Hi, You're completely right, I'll add a couple of examples in the next few days. Thank you, for your input.

chmac commented 8 years ago

Any update on this? Don't see any error handling in the examples...

mreid1130 commented 8 years ago

would love to see some examples of error handling as well

ruipgil commented 8 years ago

I've added one example that covers various cases of how to handle errors.

chmac commented 8 years ago

@ruipgil Awesome, thanks. Does the same approach of using throw work in the DynamicScraper?

ruipgil commented 8 years ago

Good point @chmac ! In the dynamic scraper, exceptions from the scrape promise cannot be catch by the onError promise. I may tweak the code to take it into account.