Skip to content

Instantly share code, notes, and snippets.

@spion
Created May 13, 2016 21:12
Show Gist options
  • Save spion/04d6a65d157078edceb2c820ef085c7c to your computer and use it in GitHub Desktop.
Save spion/04d6a65d157078edceb2c820ef085c7c to your computer and use it in GitHub Desktop.

We have

function blah(done) {
  doSomething(function(err, data) {
    if (err) return done(err);
    var x = JSON.parse(data);
    doOtherThings();
    done(null, x);
  });
}

If we run this in a domain and JSON.parse throws, our process continues.

If we run this in a promise and JSON.parse throws, the process crashes.

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