phantomas
phantomas copied to clipboard
err 252 even if finished while using phantomas as Promise
I've been aware of this issue for a while thinking it might be on purpose.
When using phantomas in a classic node callback :
phantomas('https://snipcart.com', {/*some options*/}, function(err, json, results) {
console.log(err) //errorMessage : 252
console.log(results)
/* outputs:
{ setMetric: [Function],
getMetric: [Function],
getMetrics: [Function],
getMetricsNames: [Function],
addOffender: [Function],
getOffenders: [Function],
getAllOffenders: [Function],
setUrl: [Function],
getUrl: [Function],
setGenerator: [Function],
getGenerator: [Function],
setAssert: [Function],
setAsserts: [Function],
getAsserts: [Function],
hasAssertion: [Function],
getAssertion: [Function],
assert: [Function],
getFailedAsserts: [Function] }
*/
});
The problem here is that the result object is filled with accurate results so it makes the data usable. Because there is an error, using phantomas as a promise makes data unusable since the fail handler is automatically called.
phantomas('https://snipcart.com', {/*some options*/})
.then(function(json, data){
// ...
})
.fail(function(err){
console.log(err) // called
});
I'm not sure why it's happening yet, it might come from Phantomjs poor behaviour with ssl but not sure at all.
In any case,I think this should not be happening
Hi everyone, do you know any workaround for now on this bug ?
Thanks
sorry @kennydee, I didn't look at this for a while is it still happening ? @macbre
I can confirm that this is still happening. I'm running phantomas from node.js using async/await.
Guys, is this problem happening only for exit code 252 (EXIT_TIMED_OUT
)? This will be against promise principles (as there was an error and metrics are not calculated for a full page load), but we can skip generating failed promise for this exit code only.
What do you think?