Null error in method call

I recently upgraded to 1.7.1 (beta) from 1.6 because 1.7.0 has a buggy build, and I’m seeing that in many places where I expect an error to be undefined, it is now coming back as null, the fix is relatively simple - but in many places, so I wanted to check if this is expected?

Meteor.call("whatever", (err, res) => {
  if (err === undefined){
    //process result
  }
  else {
   //process err
  }
});

I’ve not noticed the change in behaviour - maybe because I’ve never looked! An error of null seems to be more common in npm-world. However, I’ve always done the lazy test, which works with null or undefined.

if (error) {
  // handle the error
} else {
  // handle the result
}

We do the lazy test in most places - but we have some old code written by an over zelous (but probably “correct”) developer - he liked typeof err === "undefined"! I guess I’ll just go through and fix, but wanted to check if anyone else had noticed this behaviour first

1 Like

@robfallows turns out it wasn’t all meteor calls, it was specifically callbacks from mongo client side updates, and the change was introduced about 10 months ago in the mongo package. I’ve reported it as a “bug” in github