Created
June 4, 2018 18:54
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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