You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The doco says that for the callbacks, if everything went OK then the err object will be null. However it is not 'null' it is 'undefined'. I have confirmed this for ensureIndex() but I think it is in most of not all cases.
The behaviour of the 'err' object should be as consistent as possible and the doco should be as clear and accurate as possible. So I recommend choosing either 'null' or 'undefined' and ensuring that the 'err' object is always the same value in the 'success' case for all API calls and that the doco states the correct value.
Thanks for this useful library.
The text was updated successfully, but these errors were encountered:
Good idea, I just pushed a new version where in all successful calls, err is null. That said, the best way to check for success is to use if (err) { ... } and not if (err === null) { ... } so that even if it is undefined the code is still valid.
The doco says that for the callbacks, if everything went OK then the err object will be null. However it is not 'null' it is 'undefined'. I have confirmed this for ensureIndex() but I think it is in most of not all cases.
The behaviour of the 'err' object should be as consistent as possible and the doco should be as clear and accurate as possible. So I recommend choosing either 'null' or 'undefined' and ensuring that the 'err' object is always the same value in the 'success' case for all API calls and that the doco states the correct value.
Thanks for this useful library.
The text was updated successfully, but these errors were encountered: