/** * Runs and returns method response * @param $requestObject * @throws \Exception * @throws \yii\web\HttpException * @return Response */ private function getActionResponse($requestObject) { $this->requestObject = $result = $error = null; try { $this->parseAndValidateRequestObject($requestObject); ob_start(); $dirtyResult = parent::runAction($this->requestObject->method); ob_clean(); $result = $this->validateResult($dirtyResult); } catch (HttpException $e) { throw $e; } catch (Exception $e) { $error = $e; } catch (\Exception $e) { $error = new Exception("Internal error", Exception::INTERNAL_ERROR); } if (!isset($this->requestObject->id) && (empty($error) || !in_array($error->getCode(), [Exception::PARSE_ERROR, Exception::INVALID_REQUEST]))) { return null; } return Helper::formatResponse($result, $error, isset($this->requestObject->id) ? $this->requestObject->id : null); }
public function __construct($message, $code, $data = null) { parent::__construct($message, $code, $data); }