Skip to content

Instantly share code, notes, and snippets.

@pierreinglebert
Created February 10, 2015 09:23
Show Gist options
  • Save pierreinglebert/84f1825f8d93bdea92c4 to your computer and use it in GitHub Desktop.
Save pierreinglebert/84f1825f8d93bdea92c4 to your computer and use it in GitHub Desktop.
try/catch async
'use strict';
var fs = require('fs');
fs.writeFileSync('testtry.txt', 'just a test file');
try{
fs.readFile('testtry.txt', function() {
throw new Error();
});
} catch(err) {
console.log('!!!!!!!!!!!!!!!!!! I CAUGHT IT !!!!!!!!!!!!!!!!!!!');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment