code: 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);
      }
    }
  }
docs: pass err to the global error handler if specified