Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Created May 1, 2016 22:27
Show Gist options
  • Select an option

  • Save andrewjmead/0d64d848aa18cdaf9383448e6fe17a63 to your computer and use it in GitHub Desktop.

Select an option

Save andrewjmead/0d64d848aa18cdaf9383448e6fe17a63 to your computer and use it in GitHub Desktop.
Jerome Try/Catch
/**
* In the following example, the code in the try block will trigger the catch block
* without explicitly calling "throw new Error('error message')"
*
* When you try to reference a variable that does not exist, Node itself will throw
* the error.
*/
try {
console.log(varNotReal);
} catch (e) {
console.log('Error', e);
}
@auchomage
Copy link
Copy Markdown

Many thanks for this.
Things are clearer now.

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