Skip to content

Instantly share code, notes, and snippets.

@mstijak
Created November 13, 2016 21:49
Show Gist options
  • Save mstijak/715fa2dd3f495a98386c3ebbadbabb8c to your computer and use it in GitHub Desktop.
Save mstijak/715fa2dd3f495a98386c3ebbadbabb8c to your computer and use it in GitHub Desktop.
Google Bot Crawl Debugging
window.onerror = function (message, url, lineNo, colNo, error) {
console.log(arguments);
let container = document.createElement('div');
container.style.color = 'red';
container.style.position = 'fixed';
container.style.background = '#eee';
container.style.padding = '2em';
container.style.top = '1em';
container.style.left = '1em';
let msg = document.createElement('pre');
msg.innerText = [
'Message: ' + message,
'URL: ' + url,
'Line: ' + lineNo,
'Column: ' + colNo,
'Stack: ' + (error && error.stack)
].join('\n');
container.appendChild(msg);
document.body.appendChild(container);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment