code: function hapiRegisterFunction(server, options, next) {
      if (isObject(server)) {
        if (isFunction(server.on)) {
          server.on('request-error', function(req, err) {
            var em = hapiErrorHandler(req, err, config);
  
            client.sendError(em);
          });
        }
  
        if (isFunction(server.ext)) {
          server.ext('onPreResponse', function(request, reply) {
            var em = null;
  
            if (isObject(request) && isObject(request.response) &&
                request.response.isBoom) {
              em = hapiErrorHandler(request, new Error(request.response.message),
                                    config);
  
              client.sendError(em);
            }
  
            if (isObject(reply) && isFunction(reply.continue)) {
              reply.continue();
            }
          });
        }
      }
  
      if (isFunction(next)) {
        return next();
      }
    }
docs: The register function serves to attach the hapiErrorHandler to specific
  points in the hapi request-response lifecycle. Namely: it attaches to the
  'request-error' event in Hapi which is emitted when a plugin or receiver
  throws an error while executing and the 'onPreResponse' event to intercept
  error code carrying requests before they are sent back to the client so
  that the errors can be logged to the Error Reporting API.
  @function hapiRegisterFunction
  @param {Hapi.Server} server - A Hapi server instance
  @param {Object} options - The server configuration options object
  @param {Function} next - The Hapi callback to move execution to the next
  plugin
  @returns {Undefined} - returns the execution of the next callback