phantomas icon indicating copy to clipboard operation
phantomas copied to clipboard

err 252 even if finished while using phantomas as Promise

Open EFF opened this issue 8 years ago • 4 comments

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

EFF avatar Apr 18 '16 22:04 EFF

Hi everyone, do you know any workaround for now on this bug ?

Thanks

kennydee avatar Nov 29 '16 07:11 kennydee

sorry @kennydee, I didn't look at this for a while is it still happening ? @macbre

EFF avatar Nov 30 '16 21:11 EFF

I can confirm that this is still happening. I'm running phantomas from node.js using async/await.

GrzegorzBlok avatar Apr 10 '17 17:04 GrzegorzBlok

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?

macbre avatar May 22 '17 18:05 macbre