mirror of
https://github.com/silverstripe/silverstripe-behat-extension
synced 2024-10-22 17:05:32 +02:00
Merge pull request #64 from tractorcow/pulls/stacktrace
API Support extended JS error reporting
This commit is contained in:
commit
78cfd94240
@ -76,8 +76,12 @@ 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];
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user