From c4b29f789df0fe2c6d046483363b86242e290cd8 Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Sun, 9 Feb 2014 12:14:06 +0100 Subject: [PATCH] Error code works as expected --- lib/datastore.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/datastore.js b/lib/datastore.js index df1bd69..7986d9f 100644 --- a/lib/datastore.js +++ b/lib/datastore.js @@ -546,4 +546,21 @@ Datastore.prototype.remove = function () { }; + +process.on('uncaughtException', function (err) { + console.log(err); +}); + +var ds = new Datastore(); +ds.find({}, function (err) { + process.nextTick(function () { + ds.insert({ bar: 1 }, function (err) { + //We never get here + }); + }); + throw 'foo'; +}); + + + module.exports = Datastore;