Skip to content

Instantly share code, notes, and snippets.

@erikvorhes
Created June 4, 2018 18:54
Show Gist options
  • Select an option

  • Save erikvorhes/2e3db959a315cf767314b7e3d6081e2c to your computer and use it in GitHub Desktop.

Select an option

Save erikvorhes/2e3db959a315cf767314b7e3d6081e2c to your computer and use it in GitHub Desktop.
Maybe you need help with an error; maybe you’ll find help with that same error
const errorHelpMaybe = (func) => {
try {
func();
} catch (err) {
const { name, message } = err;
const url = `https://stackoverflow.com/search?q=${encodeURIComponent(`${name} ${message}`)}`;
console.log(name, message, url);
window.open(url, `StackOverflow${Math.random()}`);
throw err;
}
};
export default errorHelpMaybe;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment