Skip to content

Instantly share code, notes, and snippets.

@takaheraw
Created January 4, 2013 11:02
Show Gist options
  • Save takaheraw/4451711 to your computer and use it in GitHub Desktop.
Save takaheraw/4451711 to your computer and use it in GitHub Desktop.
var fs = require('fs');
process.on('uncaughtException', function(e){
console.log('uncaughtException:', e.message);
});
try{
fs.readFile('non-exists.txt', 'utf-8', function(err, data){
if(err) throw err;
console.log('data:', data);
});
}catch(e){
console.log('catch:', e.message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment