Error handling in pageres (PhantomJS)
<p>I'm trying to work out how to handle errors in a simple <a href="https://github.com/sindresorhus/pageres" rel="nofollow">Pageres</a> script.</p>

<p>At the moment, when it runs, it runs just how I want it. But when there's an error, it hangs and the server requires a reboot.</p>

<p>All I want it to do:</p>

<ol>
<li>If there's an error, write a message to a log file (in /var/log)</li>
<li>Exit</li>
</ol>

<p>Any ideas? I've tried all sorts of things, and I don't think it's very hard but I'm not at all experienced with Node or PhantomJS.</p>

<pre><code>const Pageres = require('pageres');

const pageres = new Pageres({
    delay: 2,
    filename: '&lt;%= url %&gt;-&lt;%= size %&gt;&lt;%= crop %&gt;'
})

.src('https://example.com/', ['1920x1080'], {crop: false})
.dest('/home/storepictures/')
.run()
.then(() =&gt; console.log('done'));
</code></pre>