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
I've been aware of this issue for a while thinking it might be on purpose.
When using phantomas in a classic node callback :
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.
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