mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
API Support extended JS error reporting
This commit is contained in:
parent
bf36edecad
commit
bc3b0b4cd5
@ -76,9 +76,13 @@ class BasicContext extends BehatContext
|
|||||||
public function appendErrorHandlerBeforeStep(StepEvent $event)
|
public function appendErrorHandlerBeforeStep(StepEvent $event)
|
||||||
{
|
{
|
||||||
$javascript = <<<JS
|
$javascript = <<<JS
|
||||||
window.onerror = function(msg) {
|
window.onerror = function(message, file, line, column, error) {
|
||||||
var body = document.getElementsByTagName('body')[0];
|
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) {
|
if ('undefined' !== typeof window.jQuery) {
|
||||||
window.jQuery('body').ajaxError(function(event, jqxhr, settings, exception) {
|
window.jQuery('body').ajaxError(function(event, jqxhr, settings, exception) {
|
||||||
|
Loading…
Reference in New Issue
Block a user