Horseman exiting when PhantomJS has an error
See original GitHub issueWe’re running a fairly complicated set of tests and the last few days for some reason they’ve been failing. Most of the time it prints the following error:
{ [HeadlessError: Error parsing JSON from phantom: SyntaxError: Unexpected token E
Data from phantom was: Error 403: Directory Listing Denied
Directory listing denied]
name: 'HeadlessError',
message: 'Error parsing JSON from phantom: SyntaxError: Unexpected token E\nData from phantom was: Error 403: Directory Listing Denied\nDirectory listing denied' }
… and then exits. But sometimes it just plain exits with no logging (odd).
I’m wondering if there is a specific reason for this behavior, or maybe an undocumented option that can cause horseman to behave differently when something goes wrong in phantom?
Our ideal here is to have our series of tests continue even if one has an issue (and we’d like to log the issue we’re having with as much info as possible). But the major hangup is the script exiting.
(note: I’m aware this could be user error, but I’m not 100% familiar with the script or horseman yet so any help is appreciated).
Issue Analytics
- State:
- Created 8 years ago
- Comments:37 (3 by maintainers)
Top Results From Across the Web
Developers - Horseman exiting when PhantomJS has an error -
We're running a fairly complicated set of tests and the last few days for some reason they've been failing. Most of the time...
Read more >[Solved]-Unhandled rejection Error - horseman-phantom.js
You need to handle promise rejections with: .catch(err => { // handle the error here });. for every promise that is created in...
Read more >Web Crawling with Node, PhantomJS and Horseman - SitePoint
close(); Failing to close the Horseman instance can result in orphaned PhantomJS processes persisting on the machine.
Read more >PhantomJS exits after syntax error when running unit tests
I usually use this code to warn about errors and resume the run (phantomjs) phantom.onError = function(msg, trace) { var msgStack = ['PHANTOM...
Read more >Replace PhantomJS with Headless Chromium for JavaScript ...
PhantomJS is a “headless” internet browser, meaning it has no user interface. ... The Headless Horseman Pursuing Ichabod Crane — John Quidor ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was running it on the machine at my desk which I recently rebuilt @ohenepee , so it’s pretty powerful:
So if the issue happen when running out processor power, I guess that won’t happen on that computer. I have some deadline coming up at work, but some point in the future I should be able to test in a VM or something.
That would defeat the purpose of the
.reject()
@Gazaret. Inside thatif
is an error condition. A.catch
at the end of the chain of horseman actions should catch that reject.