static function handleTestError($errno, $errstr, $errfile, $errline, $context, $backtraceInfo) { // generate a unique id for this entry in the error log $errorId = uniqid(); // format the backtrace and log the error $errorLine = self::formatErrorLineHtml($errno, $errstr, $errfile, $errline, $context, $backtraceInfo); error_log("<p>error #{$errorId}:</p>", 3, instance_dir . '/var/log/error.html'); error_log('<p>' . $errorLine . '</p>', 3, instance_dir . '/var/log/error.html'); $backtraceInfo = $backtraceInfo ? $backtraceInfo : debug_backtrace(); $backtrace = new Backtrace($backtraceInfo); error_log($backtrace->toHtml(), 3, instance_dir . '/var/log/error.html'); // wipe out all output buffers while (ob_get_level()) { ob_end_clean(); } // display the error code echo "error #{$errorId}"; // $scriptUrl = script_url; // $baseUrl = base_url; // include(app_dir . "/error.html"); die; }
private function checkResponse($response, $responseToken, $token, $query = null) { if (!isset($response['t'])) { throw new RqlDriverError("Response message has no type."); } if ($response['t'] == pb\Response_ResponseType::PB_CLIENT_ERROR) { throw new RqlDriverError("Server says PHP-RQL is buggy: " . $response['r'][0]); } if ($responseToken != $token) { throw new RqlDriverError("Received wrong token. Response does not match the request. Expected {$token}, received " . $responseToken); } if ($response['t'] == pb\Response_ResponseType::PB_COMPILE_ERROR) { $backtrace = null; if (isset($response['b'])) { $backtrace = Backtrace::_fromJSON($response['b']); } throw new RqlServerError("Compile error: " . $response['r'][0], $query, $backtrace); } else { if ($response['t'] == pb\Response_ResponseType::PB_RUNTIME_ERROR) { $backtrace = null; if (isset($response['b'])) { $backtrace = Backtrace::_fromJSON($response['b']); } throw new RqlServerError("Runtime error: " . $response['r'][0], $query, $backtrace); } } }
private function checkResponse(pb\Response $response, $token, $query = null) { if (is_null($response->getType())) { throw new RqlDriverError("Response message has no type."); } if ($response->getToken() != $token) { throw new RqlDriverError("Received wrong token. Response does not match the request. Expected {$token}, received " . $response->getToken()); } if ($response->getType() == pb\Response_ResponseType::PB_CLIENT_ERROR) { throw new RqlDriverError("Server says PHP-RQL is buggy: " . $response->getResponseAt(0)->getRStr()); } else { if ($response->getType() == pb\Response_ResponseType::PB_COMPILE_ERROR) { $backtrace = null; if (!is_null($response->getBacktrace())) { $backtrace = Backtrace::_fromProtobuffer($response->getBacktrace()); } throw new RqlUserError("Compile error: " . $response->getResponseAt(0)->getRStr(), $query, $backtrace); } else { if ($response->getType() == pb\Response_ResponseType::PB_RUNTIME_ERROR) { $backtrace = null; if (!is_null($response->getBacktrace())) { $backtrace = Backtrace::_fromProtobuffer($response->getBacktrace()); } throw new RqlUserError("Runtime error: " . $response->getResponseAt(0)->getRStr(), $query, $backtrace); } } } }