Not sure it's the best error handling method but it works

This commit is contained in:
Gaël Métais
2014-08-05 00:26:34 +02:00
parent df4c93356e
commit 3f3e250a49
+15 -9
View File
@@ -29,14 +29,20 @@ exports.module = function(phantomas) {
phantomas.incrMetric('jsErrors');
phantomas.addOffender('jsErrors', msg + ' - ' + trace.join(' / '));
// TODO : send the error back to the browser ?
/*phantomas.pushContext({
type: 'error',
callDetails: {
arguments: [msg]
},
caller: trace[0],
backtrace: trace.join(' / ')
});*/
// Yeah, this is weird, i'm sending the error back to the browser...
phantomas.evaluate(function(msg, caller, trace) {
(function(phantomas) {
phantomas.pushContext({
type: 'error',
callDetails: {
arguments: [msg]
},
caller: caller,
backtrace: trace
});
})(window.__phantomas);
}, msg, trace[0], trace.join(' / '));
});
};