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


PHP Throwable::report方法代碼示例

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


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

示例1: report

 /**
  * Report an exception to the user
  * @param Exception|Throwable $e
  */
 protected static function report($e)
 {
     try {
         // Try and show the exception prettily, with the normal skin infrastructure
         if ($e instanceof MWException) {
             // Delegate to MWException until all subclasses are handled by
             // MWExceptionRenderer and MWException::report() has been
             // removed.
             $e->report();
         } else {
             MWExceptionRenderer::output($e, MWExceptionRenderer::AS_PRETTY);
         }
     } catch (Exception $e2) {
         // Exception occurred from within exception handler
         // Show a simpler message for the original exception,
         // don't try to invoke report()
         MWExceptionRenderer::output($e, MWExceptionRenderer::AS_RAW, $e2);
     }
 }
開發者ID:paladox,項目名稱:mediawiki,代碼行數:23,代碼來源:MWExceptionHandler.php

示例2: report

 /**
  * Report an exception to the user
  * @param Exception|Throwable $e
  */
 protected static function report($e)
 {
     global $wgShowExceptionDetails;
     $cmdLine = MWException::isCommandLine();
     if ($e instanceof MWException) {
         try {
             // Try and show the exception prettily, with the normal skin infrastructure
             $e->report();
         } catch (Exception $e2) {
             // Exception occurred from within exception handler
             // Show a simpler message for the original exception,
             // don't try to invoke report()
             $message = "MediaWiki internal error.\n\n";
             if ($wgShowExceptionDetails) {
                 $message .= 'Original exception: ' . self::getLogMessage($e) . "\nBacktrace:\n" . self::getRedactedTraceAsString($e) . "\n\nException caught inside exception handler: " . self::getLogMessage($e2) . "\nBacktrace:\n" . self::getRedactedTraceAsString($e2);
             } else {
                 $message .= "Exception caught inside exception handler.\n\n" . "Set \$wgShowExceptionDetails = true; at the bottom of LocalSettings.php " . "to show detailed debugging information.";
             }
             $message .= "\n";
             if ($cmdLine) {
                 self::printError($message);
             } else {
                 echo nl2br(htmlspecialchars($message)) . "\n";
             }
         }
     } else {
         $message = "Exception encountered, of type \"" . get_class($e) . "\"";
         if ($wgShowExceptionDetails) {
             $message .= "\n" . self::getLogMessage($e) . "\nBacktrace:\n" . self::getRedactedTraceAsString($e) . "\n";
         }
         if ($cmdLine) {
             self::printError($message);
         } else {
             echo nl2br(htmlspecialchars($message)) . "\n";
         }
     }
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:41,代碼來源:MWExceptionHandler.php


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