lib/server/server.js
function (isGlobal, server, err, msg, session, resp, opts, cb) {
  let handler;
  if (isGlobal) {
    handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER);
  } else {
    handler = server.app.get(Constants.RESERVED.ERROR_HANDLER);
  }
  if (!handler) {
    logger.debug('no default error handler to resolve unknown exception. ' + err.stack);
    utils.invokeCallback(cb, err, resp, opts);
  } else {
    if (handler.length === 5) {
      handler(err, msg, resp, session, cb);
    } else {
      handler(err, msg, resp, session, opts, cb);
    }
  }
}
function (isGlobal, server, err, msg, session, resp, opts, cb) {
  let handler;
  if (isGlobal) {
    handler = server.app.get(Constants.RESERVED.GLOBAL_ERROR_HANDLER);
  } else {
    handler = server.app.get(Constants.RESERVED.ERROR_HANDLER);
  }
  if (!handler) {
    logger.debug('no default error handler to resolve unknown exception. ' + err.stack);
    utils.invokeCallback(cb, err, resp, opts);
  } else {
    if (handler.length === 5) {
      handler(err, msg, resp, session, cb);
    } else {
      handler(err, msg, resp, session, opts, cb);
    }
  }
}
function ( isGlobal , server , err , msg , session , resp , opts , cb ) { let handler ; if ( isGlobal ) { handler = server . app . get ( Constants . RESERVED . GLOBAL_ERROR_HANDLER ) ; } else { handler = server . app . get ( Constants . RESERVED . ERROR_HANDLER ) ; } if ( ! handler ) { logger . debug ( 'no default error handler to resolve unknown exception. ' + err . stack ) ; utils . invokeCallback ( cb , err , resp , opts ) ; } else { if ( handler . length === 5 ) { handler ( err , msg , resp , session , cb ) ; } else { handler ( err , msg , resp , session , opts , cb ) ; } } }
pass err to the global error handler if specified
pass err to the global error handler if specified