protected function processNonExportResult(& $result)
    {
        $matches = array();
        #$hasMatch = preg_match('/^[\s]*{"error":[\s]*"(.*)"}[\s]*$/', $result, $matches);
        $hasMatch = preg_match(self::JSON_RESULT_ERROR_PATTERN, $result, $matches);
        if ($hasMatch === 1) {
            // note: $matches[0] is the complete string that matched
            //       $matches[1] is just the error message part
            $message = $matches[1];
            $message = str_replace('\"', '"', $message);
            $message = str_replace('\n', "\n", $message);
             
            $code    = ErrorHandlerInterface::REDCAP_API_ERROR;
            $this->errorHandler->throwException($message, $code);
        } // @codeCoverageIgnore
    }
protected function processNonExportResult(& $result)
    {
        $matches = array();
        #$hasMatch = preg_match('/^[\s]*{"error":[\s]*"(.*)"}[\s]*$/', $result, $matches);
        $hasMatch = preg_match(self::JSON_RESULT_ERROR_PATTERN, $result, $matches);
        if ($hasMatch === 1) {
            // note: $matches[0] is the complete string that matched
            //       $matches[1] is just the error message part
            $message = $matches[1];
            $message = str_replace('\"', '"', $message);
            $message = str_replace('\n', "\n", $message);
             
            $code    = ErrorHandlerInterface::REDCAP_API_ERROR;
            $this->errorHandler->throwException($message, $code);
        } // @codeCoverageIgnore
    }
protected function processNonExportResult ( & $ result ) { $ matches = array ( ) ; #$hasMatch = preg_match('/^[\s]*{"error":[\s]*"(.*)"}[\s]*$/', $result, $matches); $ hasMatch = preg_match ( self :: JSON_RESULT_ERROR_PATTERN , $ result , $ matches ) ; if ( $ hasMatch === 1 ) { // note: $matches[0] is the complete string that matched //       $matches[1] is just the error message part $ message = $ matches [ 1 ] ; $ message = str_replace ( '\"' , '"' , $ message ) ; $ message = str_replace ( '\n' , "\n" , $ message ) ; $ code = ErrorHandlerInterface :: REDCAP_API_ERROR ; $ this -> errorHandler -> throwException ( $ message , $ code ) ; } // @codeCoverageIgnore }
Checks the result returned from the REDCap API for non-export methods.
PHPCap is set to return errors from REDCap using JSON, so the result
string is checked to see if there is a JSON format error, and if so,
and exception is thrown using the error message returned from the
REDCap API.

@param string $result a result returned from the REDCap API, which
should be for a non-export method.
Checks the result returned from the REDCap API for non - export methods . PHPCap is set to return errors from REDCap using JSON so the result string is checked to see if there is a JSON format error and if so and exception is thrown using the error message returned from the REDCap API .