mongodb/node-mongodb-native — pull request #832 by m4tty (2013-01-05 04:29:29+00:00)
Title: removed the double wrap of sorts, by not passing an Error object to the wrap function.

wrap was being passed an Error object containing the MongoError, but wrap expects a MongoError document alone which it will wrap in an Error object. In this case, findOne was putting the MongoError document into an Error object and then also handing that Error object to wrap, which would then new up another Error object and use the input Error as the message.

I couldn't find any other instances of this issue other than this one (in findOne).

Possibly could check for instanceOf Error within wrap to double check and then unwrap (i.e. pull the message) and rewrap.