Node.js callback error pattern
First, there is a principle you should be reminded: 
Never deal with the error you don't know, just pop it up.

Which means, if you can't deal with or don't know about the error passed in the callback, you just pass it to next callback, or throw it(A pattern of CHAIN OF RESPONSIBILITY)!

For the errors you know how to deal with it, you can define a module for error handling and deal with it according to the type of error and log the error for debugging, like the following way.

error-handler.js

var log = require('./log'); // Log module(local or third-party);

function handler(error){
  if(error instanceof error1){
    // log it
    // handler for error1
  }else if(error instanceof error2){
    // log it 
    // handler for error2
  }else if ....
};

module.exports = handler;


logic.js

var errorHandler = require('./error-handler');

db.open(function(err, connection){
  if(err){ return errorHandler(err); }
});


For good modules like mongoose will throw their customized Errors.