當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MWExceptionHandler::getRedactedTraceAsString方法代碼示例

本文整理匯總了PHP中MWExceptionHandler::getRedactedTraceAsString方法的典型用法代碼示例。如果您正苦於以下問題:PHP MWExceptionHandler::getRedactedTraceAsString方法的具體用法?PHP MWExceptionHandler::getRedactedTraceAsString怎麽用?PHP MWExceptionHandler::getRedactedTraceAsString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MWExceptionHandler的用法示例。


在下文中一共展示了MWExceptionHandler::getRedactedTraceAsString方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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'];
 }
開發者ID:soumyag213,項目名稱:mediawiki,代碼行數:45,代碼來源:ApiMain.php

示例2: getText

 /**
  * Get the text to display when reporting the error on the command line.
  * If $wgShowExceptionDetails is true, return a text message with a
  * backtrace to the error.
  *
  * @return string
  */
 function getText()
 {
     global $wgShowExceptionDetails;
     if ($wgShowExceptionDetails) {
         return MWExceptionHandler::getLogMessage($this) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($this) . "\n";
     } else {
         return "Set \$wgShowExceptionDetails = true; " . "in LocalSettings.php to show detailed debugging information.\n";
     }
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:16,代碼來源:Exception.php

示例3: 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();
     $errMessage = $this->errorMessageFromException($e);
     if ($e instanceof UsageException) {
         // User entered incorrect parameters - generate error response
         $link = wfExpandUrl(wfScript('api'));
         ApiResult::setContentValue($errMessage, 'docref', "See {$link} for API usage");
     } else {
         // Something is seriously wrong
         if ($config->get('ShowExceptionDetails')) {
             ApiResult::setContentValue($errMessage, 'trace', MWExceptionHandler::getRedactedTraceAsString($e));
         }
     }
     // Remember all the warnings to re-add them later
     $warnings = $result->getResultData(['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'];
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:39,代碼來源:ApiMain.php

示例4: getText

 /**
  * @param Exception|Throwable $e
  * @return string
  */
 private static function getText($e)
 {
     if (self::showBackTrace($e)) {
         return MWExceptionHandler::getLogMessage($e) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($e) . "\n";
     } else {
         return "Set \$wgShowExceptionDetails = true; " . "in LocalSettings.php to show detailed debugging information.\n";
     }
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:12,代碼來源:MWExceptionRenderer.php


注:本文中的MWExceptionHandler::getRedactedTraceAsString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。