This file contains 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
class MyError extends Error {} | |
try { | |
doStuff(); | |
} catch(err) { | |
if (err.name == 'MyError') { | |
console.log("This is my error"); | |
} else if (err.name == 'ReferenceError') { | |
console.log("Not my error. Ask the ReferenceError guys"); | |
} else { | |
console.log("I have no idea"); | |
throw err; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment