public function afterAction($action, $result) { $result = parent::afterAction($action, $result); if ($this->response->getStatusCode() == 200) { return $this->respondByFormat(); } return $result; }
public function afterAction($action, $result) { $errorHandler = Yii::$app->get('errorHandler'); if (!empty($errorHandler->exception)) { $this->handleException($errorHandler->exception); } $result = parent::afterAction($action, $result); if ($this->response->getStatusCode() == 200) { return $this->respondByFormat(); } return $result; }