text: /**
   * GeniusReferralsLib
   *
   * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ) on 02/18/2017
   */
  
  
  var BaseController = {
  
      /**
       * Global error handling
       * @param	{HttpContext}	context			HttpContext containing request and response objects
       * @return	{function}		callback		Callback function in the form of function(error, response, context)
       */
  	validateResponse(context, endpName) {
          var errorObj = {
              errorMessage: "",
              errorCode: "",
              errorResponse: context.response.body
          };
  		var returnObj = {
              error: errorObj,
              response: null,
              context: context
          };
  
          if (context.response.statusCode === 401) {
              returnObj.error.errorMessage = "You are not authenticated";
              returnObj.error.errorCode = 401;
          } else if (context.response.statusCode === 403) {
              returnObj.error.errorMessage = "User not authorized to perform the operation";
              returnObj.error.errorCode = 403;
          } else if (context.response.statusCode === 404) {
              returnObj.error.errorMessage = "Resource not found";
              returnObj.error.errorCode = 404;
              returnObj.response = context.body.response;
          } else {
              returnObj.error.errorMessage = "HTTP Response Not OK";
              returnObj.error.errorCode = context.response.statusCode;
           }
  
  		return returnObj;
      },
  };
  
  module.exports = BaseController;
  