Neos\Neos\Service\Controller\AbstractServiceController::processRequest PHP Метод

processRequest() публичный Метод

Catch exceptions while processing an exception and respond to JSON format TODO: This is an explicit exception handling that will be replaced by format-enabled exception handlers.
public processRequest ( Neos\Flow\Mvc\RequestInterface $request, Neos\Flow\Mvc\ResponseInterface $response ) : void
$request Neos\Flow\Mvc\RequestInterface The request object
$response Neos\Flow\Mvc\ResponseInterface The response, modified by this handler
Результат void
    public function processRequest(RequestInterface $request, ResponseInterface $response)
    {
        try {
            parent::processRequest($request, $response);
        } catch (StopActionException $exception) {
            throw $exception;
        } catch (\Exception $exception) {
            if ($this->request->getFormat() !== 'json' || !$response instanceof HttpResponse) {
                throw $exception;
            }
            $exceptionData = $this->convertException($exception);
            $response->setHeader('Content-Type', 'application/json');
            if ($exception instanceof FlowException) {
                $response->setStatus($exception->getStatusCode());
            } else {
                $response->setStatus(500);
            }
            $response->setContent(json_encode(array('error' => $exceptionData)));
            $this->systemLogger->logException($exception);
        }
    }