renderException() protected méthode

Renders the exception.
protected renderException ( Exception $exception )
$exception Exception the exception to be rendered.
Exemple #1
0
 /**
  * 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);
 }
 protected function renderException($exception)
 {
     if (YII_ENV !== 'dev') {
         $this->sendErrorMessageToDevelopers($exception);
     }
     parent::renderException($exception);
 }
 /**
  * @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);
 }
 /**
  * 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();
 }
Exemple #5
0
 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);
     }
 }