Skip to content

Instantly share code, notes, and snippets.

@daniellmb
Last active July 12, 2020 13:30
Show Gist options
  • Save daniellmb/7ffe7da82af6ee85a665 to your computer and use it in GitHub Desktop.
Save daniellmb/7ffe7da82af6ee85a665 to your computer and use it in GitHub Desktop.
Automagically look up JavaScript errors on Stack Overflow ;-)

Automagically look up JavaScript errors on Stack Overflow 😄

window.onerror = function(message) {
top.location.href = 'http://stackoverflow.com/search?q=' +
encodeURIComponent(message + ' [js]');
};
@daniellmb
Copy link
Author

Want to try it? Just past the function into the Dev Tools and execute it, then throw an error using setTimeout like so:

setTimeout(function() { foo; }, 0)

You'll end up here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment