renderException() protected method

Renders the exception.
protected renderException ( Exception $exception )
$exception Exception the exception to be rendered.
コード例 #1
0
ファイル: ErrorHandler.php プロジェクト: snivs/semanti
 /**
  * Renders the exception.
  * @param \Exception $exception the exception to be rendered.
  */
 protected function renderException($exception)
 {
     // debug info ----------------------------------------------------------
     \common\helpers\AppDebug::dump(['method' => __METHOD__, 'line' => __LINE__, 'exception' => $this->htmlEncode($this->convertExceptionToString($exception)), 'module' => AppHelper::getModuleName(), 'controller' => AppHelper::getControllerName(), 'action' => AppHelper::getActionName(), 'route' => AppHelper::getRoute(), 'clientIp' => AppHelper::getClientIp()]);
     // ---------------------------------------------------------------------
     parent::renderException($exception);
 }
コード例 #2
0
 protected function renderException($exception)
 {
     if (YII_ENV !== 'dev') {
         $this->sendErrorMessageToDevelopers($exception);
     }
     parent::renderException($exception);
 }
コード例 #3
0
 /**
  * @inheritdoc
  * @param \Exception $exception
  */
 protected function renderException($exception)
 {
     parent::renderException($exception);
     $status_code = 0;
     if (Yii::$app->has('response')) {
         $status_code = Yii::$app->getResponse()->statusCode;
     }
     $this->saveErrorInfo($exception, $status_code);
 }
コード例 #4
0
 /**
  * Renders the exception.
  * @param \Exception $exception the exception to be rendered.
  */
 protected function renderException($exception)
 {
     if (!$exception instanceof JqException) {
         parent::renderException($exception);
         return;
     }
     if (\Yii::$app->has('response')) {
         $response = \Yii::$app->getResponse();
     } else {
         $response = new Response();
     }
     $response->setStatusCode(500);
     $response->data['message'] = $exception->getMessage();
     $response->send();
 }
コード例 #5
0
ファイル: ErrorHandler.php プロジェクト: hughcube/yii2-web
 protected function renderException($exception)
 {
     if ($this->useErrorAction) {
         $result = Yii::$app->runAction($this->errorAction);
         /**
          * 任何以\yii\base\Response为基类的实例都当成相应组建的返回
          */
         if ($result instanceof \yii\base\Response) {
             $response = $result;
         } else {
             if (Yii::$app->has('response')) {
                 $response = Yii::$app->getResponse();
                 $response->isSent = false;
                 $response->stream = $response->data = $response->content = null;
             } else {
                 $response = new Response();
             }
             $response->data = $result;
         }
         $response->send();
     } else {
         return parent::renderException($exception);
     }
 }