当前位置: 首页>>代码示例>>PHP>>正文


PHP Exception::getIsUnlogged方法代码示例

本文整理汇总了PHP中Exception::getIsUnlogged方法的典型用法代码示例。如果您正苦于以下问题:PHP Exception::getIsUnlogged方法的具体用法?PHP Exception::getIsUnlogged怎么用?PHP Exception::getIsUnlogged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Exception的用法示例。


在下文中一共展示了Exception::getIsUnlogged方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleRequestException

 public function handleRequestException(AphrontRequest $request, Exception $ex)
 {
     $viewer = $this->getViewer($request);
     // Some types of uninteresting request exceptions don't get logged, usually
     // because they are caused by the background radiation of bot traffic on
     // the internet. These include requests with bad CSRF tokens and
     // questionable "Host" headers.
     $should_log = true;
     if ($ex instanceof AphrontMalformedRequestException) {
         $should_log = !$ex->getIsUnlogged();
     }
     if ($should_log) {
         phlog($ex);
     }
     $class = get_class($ex);
     $message = $ex->getMessage();
     if ($ex instanceof AphrontSchemaQueryException) {
         $message .= "\n\n" . pht("NOTE: This usually indicates that the MySQL schema has not been " . "properly upgraded. Run '%s' to ensure your schema is up to date.", 'bin/storage upgrade');
     }
     if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) {
         $trace = id(new AphrontStackTraceView())->setUser($viewer)->setTrace($ex->getTrace());
     } else {
         $trace = null;
     }
     $content = phutil_tag('div', array('class' => 'aphront-unhandled-exception'), array(phutil_tag('div', array('class' => 'exception-message'), $message), $trace));
     $dialog = new AphrontDialogView();
     $dialog->setTitle(pht('Unhandled Exception ("%s")', $class))->setClass('aphront-exception-dialog')->setUser($viewer)->appendChild($content);
     if ($request->isAjax()) {
         $dialog->addCancelButton('/', pht('Close'));
     }
     return id(new AphrontDialogResponse())->setDialog($dialog)->setHTTPResponseCode(500);
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:32,代码来源:PhabricatorDefaultRequestExceptionHandler.php

示例2: setException

 public function setException(Exception $exception)
 {
     // Log the exception unless it's specifically a silent malformed request
     // exception.
     $should_log = true;
     if ($exception instanceof AphrontMalformedRequestException) {
         if ($exception->getIsUnlogged()) {
             $should_log = false;
         }
     }
     if ($should_log) {
         phlog($exception);
     }
     $this->exception = $exception;
     return $this;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:16,代码来源:AphrontUnhandledExceptionResponse.php


注:本文中的Exception::getIsUnlogged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。