brenden / node-webshot

Easy website screenshots in Node.js
2.12k stars 285 forks source link

errorIfStatusIsNot200 should return an error #211

Closed b4dnewz closed 6 years ago

b4dnewz commented 7 years ago

I spent a while trying to figure out why my code wasn't working until I decided to look into your code, I rely a lot on this option: errorIfStatusIsNot200 to count errors but it doesn't return an error at all.

This line should be at least process.exit(1); to give a sense to the option, but I'll suggest something like this:

var message = Status must be 200; is ' + response.status;
system.stderr.write(message);
page.close();
phantom.exit(new Error(message));

Many thanks and great tool, is working good besides some bugs, mainly related to phantomjs.