public function processRequest(RequestInterface $request, ResponseInterface $response)
    {
        $this->result = new AjaxResult;

        try {
            $this->processRequestParent($request, $response);
        } catch (Exception $exception) {
            if (false === $this->protectedRequestMode) {
                throw $exception;
            }

            $this->result->clear();

            $errorMessage = ExtensionService::get()->isInDebugMode()
                ? $this->getDebugMessageForException($exception)
                : ContextService::get()->translate(self::DEFAULT_ERROR_MESSAGE_KEY);

            $error = new Error($errorMessage, 1490176818);
            $this->result->addError($error);
            $this->result->setData('errorCode', $exception->getCode());
        }

        // Cleaning every external message.
        ob_clean();

        $this->injectResultInResponse();
    }
public function processRequest(RequestInterface $request, ResponseInterface $response)
    {
        $this->result = new AjaxResult;

        try {
            $this->processRequestParent($request, $response);
        } catch (Exception $exception) {
            if (false === $this->protectedRequestMode) {
                throw $exception;
            }

            $this->result->clear();

            $errorMessage = ExtensionService::get()->isInDebugMode()
                ? $this->getDebugMessageForException($exception)
                : ContextService::get()->translate(self::DEFAULT_ERROR_MESSAGE_KEY);

            $error = new Error($errorMessage, 1490176818);
            $this->result->addError($error);
            $this->result->setData('errorCode', $exception->getCode());
        }

        // Cleaning every external message.
        ob_clean();

        $this->injectResultInResponse();
    }
public function processRequest ( RequestInterface $ request , ResponseInterface $ response ) { $ this -> result = new AjaxResult ; try { $ this -> processRequestParent ( $ request , $ response ) ; } catch ( Exception $ exception ) { if ( false === $ this -> protectedRequestMode ) { throw $ exception ; } $ this -> result -> clear ( ) ; $ errorMessage = ExtensionService :: get ( ) -> isInDebugMode ( ) ? $ this -> getDebugMessageForException ( $ exception ) : ContextService :: get ( ) -> translate ( self :: DEFAULT_ERROR_MESSAGE_KEY ) ; $ error = new Error ( $ errorMessage , 1490176818 ) ; $ this -> result -> addError ( $ error ) ; $ this -> result -> setData ( 'errorCode' , $ exception -> getCode ( ) ) ; } // Cleaning every external message. ob_clean ( ) ; $ this -> injectResultInResponse ( ) ; }
Will process the request, but also prevent any external message to be
displayed, and catch any exception that could occur during the
validation.

@param RequestInterface  $request
@param ResponseInterface $response
@throws Exception
Will process the request but also prevent any external message to be displayed and catch any exception that could occur during the validation .