christkv/node-mongodb-native — Issue #392: Throwing an error in save callback crashes node server
Author: saintsjd
Created: 2011-11-06 04:09:13+00:00
State: open

When I throw an error inside the save callback, node crashes.

Expected behavior: the code in the catch block should run.
Actual behavior: catch code does not run. Node shutsdown with an error and must be restarted.

```javascript
try{
db.collection("users").save(user,{safe:true},function(error, docs){
//this causes node to shutdown... it should not.
if (error) throw error;
});
}catch(e){
//this code is not called. Node is already shutdown by the previous code.
console.log("caught it");
}
```