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
    }