本文整理汇总了PHP中MWExceptionHandler::getLogId方法的典型用法代码示例。如果您正苦于以下问题:PHP MWExceptionHandler::getLogId方法的具体用法?PHP MWExceptionHandler::getLogId怎么用?PHP MWExceptionHandler::getLogId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWExceptionHandler
的用法示例。
在下文中一共展示了MWExceptionHandler::getLogId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLogId
/**
* Get a the ID for this error.
*
* @since 1.20
* @deprecated since 1.22 Use MWExceptionHandler::getLogId instead.
* @return string
*/
function getLogId()
{
wfDeprecated(__METHOD__, '1.22');
return MWExceptionHandler::getLogId($this);
}
示例2: substituteResultWithError
/**
* Replace the result data with the information about an exception.
* Returns the error code
* @param Exception $e
* @return string
*/
protected function substituteResultWithError($e)
{
$result = $this->getResult();
$config = $this->getConfig();
if ($e instanceof UsageException) {
// User entered incorrect parameters - generate error response
$errMessage = $e->getMessageArray();
$link = wfExpandUrl(wfScript('api'));
ApiResult::setContentValue($errMessage, 'docref', "See {$link} for API usage");
} else {
// Something is seriously wrong
if ($e instanceof DBQueryError && !$config->get('ShowSQLErrors')) {
$info = 'Database query error';
} else {
$info = "Exception Caught: {$e->getMessage()}";
}
$errMessage = array('code' => 'internal_api_error_' . get_class($e), 'info' => '[' . MWExceptionHandler::getLogId($e) . '] ' . $info);
if ($config->get('ShowExceptionDetails')) {
ApiResult::setContentValue($errMessage, 'trace', MWExceptionHandler::getRedactedTraceAsString($e));
}
}
// Remember all the warnings to re-add them later
$warnings = $result->getResultData(array('warnings'));
$result->reset();
// Re-add the id
$requestid = $this->getParameter('requestid');
if (!is_null($requestid)) {
$result->addValue(null, 'requestid', $requestid, ApiResult::NO_SIZE_CHECK);
}
if ($config->get('ShowHostnames')) {
// servedby is especially useful when debugging errors
$result->addValue(null, 'servedby', wfHostName(), ApiResult::NO_SIZE_CHECK);
}
if ($warnings !== null) {
$result->addValue(null, 'warnings', $warnings, ApiResult::NO_SIZE_CHECK);
}
$result->addValue(null, 'error', $errMessage, ApiResult::NO_SIZE_CHECK);
return $errMessage['code'];
}
示例3: getHTML
/**
* If $wgShowExceptionDetails is true, return a HTML message with a
* backtrace to the error, otherwise show a message to ask to set it to true
* to show that information.
*
* @return string Html to output
*/
public function getHTML()
{
global $wgShowExceptionDetails;
if ($wgShowExceptionDetails) {
return '<p>' . nl2br(htmlspecialchars(MWExceptionHandler::getLogMessage($this))) . '</p><p>Backtrace:</p><p>' . nl2br(htmlspecialchars(MWExceptionHandler::getRedactedTraceAsString($this))) . "</p>\n";
} else {
return "<div class=\"errorbox\">" . '[' . MWExceptionHandler::getLogId($this) . '] ' . gmdate('Y-m-d H:i:s') . ": Fatal exception of type " . get_class($this) . "</div>\n" . "<!-- Set \$wgShowExceptionDetails = true; " . "at the bottom of LocalSettings.php to show detailed " . "debugging information. -->";
}
}