Skip to content

Instantly share code, notes, and snippets.

@afaquejam
Last active August 18, 2019 15:34
Show Gist options
  • Save afaquejam/a315ec68520a267c2238ef541aaf5c6a to your computer and use it in GitHub Desktop.
Save afaquejam/a315ec68520a267c2238ef541aaf5c6a to your computer and use it in GitHub Desktop.
Javascript Error Handling
let myName = undefined;
try {
if (myName === undefined)
throw Error('Name not defined!');
} catch (error) {
console.log(
`Error name is ${error.name} & the error message is ${error.message}`
);
} finally {
myName = 'Whadup';
}
console.log(`My name is ${myName}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment