/*!
 * letta <https://github.com/hybridables/letta>
 *
 * Copyright (c) 2015-2016 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
 * Released under the MIT license.
 */

'use strict'

var fs = require('fs')
var letta = require('../index')

/**
 * handles critical crash errors
 * like `ENOENT` and etc.
 */

letta(fs.readFile, 'foobar.json').catch(function (err) {
  console.error(err.code) // => 'ENOENT'
})

/**
 * handles ReferenceError, SyntaxError and etc.
 */

letta(function () {
  foo // eslint-disable-line no-undef
  return true
}).catch(console.error) // => 'ReferenceError: foo is not defined'

@@ -391,16 +391,25 @@
 e.error(
+'ERR1:', 
 err.code
@@ -417,16 +417,22 @@
  // =%3E '
+ERR1: 
 ENOENT'%0A
@@ -573,29 +573,66 @@
 ).catch(
-console.error
+function (err) %7B%0A  console.error('ERR2:', err.name
 ) // =%3E 
@@ -632,16 +632,22 @@
  // =%3E '
+ERR2: 
 Referenc
@@ -652,16 +652,67 @@
 nceError
+'%0A  console.error('ERR2:', err.message) // =%3E 'ERR2
 : foo is
@@ -725,8 +725,11 @@
 efined'%0A
+%7D)%0A

update exceptions example