API Support extended JS error reporting

This commit is contained in:
Damian Mooyman 2014-08-08 16:09:13 +12:00
parent bf36edecad
commit bc3b0b4cd5

View File

@ -76,9 +76,13 @@ class BasicContext extends BehatContext
public function appendErrorHandlerBeforeStep(StepEvent $event)
{
$javascript = <<<JS
window.onerror = function(msg) {
window.onerror = function(message, file, line, column, error) {
var body = document.getElementsByTagName('body')[0];
body.setAttribute('data-jserrors', '[captured JavaScript error] ' + msg);
var msg = message + " in " + file + ":" + line + ":" + column;
if(error !== undefined && error.stack !== undefined) {
msg += "\\nSTACKTRACE:\\n" + error.stack;
}
body.setAttribute('data-jserrors', '[captured JavaScript error] ' + msg);
}
if ('undefined' !== typeof window.jQuery) {
window.jQuery('body').ajaxError(function(event, jqxhr, settings, exception) {