src/Api.php
public function go()
    {
        $response = $this->getResponse();

        try {
            $request = $this->getRequest();
            $response->setWriterFactory(
                $this->getWriterFactory()
            );
            $response->setRequest(
                $request
            );
            $response->setBodyData(
                $this->getRouter()->processRequest(
                    $this->getRequest(),
                    $this->controller
                )
            );
            $response->setStatus(
                $this->controller->getStatus()
            );
        } catch (AyeAyeException $e) {
            $this->log(LogLevel::INFO, $e->getPublicMessage());
            $this->log(LogLevel::ERROR, $e->getMessage(), ['exception' => $e]);
            $response->setBodyData($e->getPublicMessage());
            $response->setStatus(new Status($e->getCode()));
        } catch (\Exception $e) {
            $status = new Status(500);
            $this->log(LogLevel::CRITICAL, $e->getMessage(), ['exception' => $e]);
            $response->setBodyData($status->getMessage());
            $response->setStatus($status);
        }

        // Ultimate fail safe
        try {
            $response->prepareResponse();
        } catch (\Exception $e) {
            $this->log(LogLevel::CRITICAL, $e->getMessage(), ['exception' => $e]);
            return $this->createFailSafeResponse();
        }

        return $response;
    }
public function go()
    {
        $response = $this->getResponse();

        try {
            $request = $this->getRequest();
            $response->setWriterFactory(
                $this->getWriterFactory()
            );
            $response->setRequest(
                $request
            );
            $response->setBodyData(
                $this->getRouter()->processRequest(
                    $this->getRequest(),
                    $this->controller
                )
            );
            $response->setStatus(
                $this->controller->getStatus()
            );
        } catch (AyeAyeException $e) {
            $this->log(LogLevel::INFO, $e->getPublicMessage());
            $this->log(LogLevel::ERROR, $e->getMessage(), ['exception' => $e]);
            $response->setBodyData($e->getPublicMessage());
            $response->setStatus(new Status($e->getCode()));
        } catch (\Exception $e) {
            $status = new Status(500);
            $this->log(LogLevel::CRITICAL, $e->getMessage(), ['exception' => $e]);
            $response->setBodyData($status->getMessage());
            $response->setStatus($status);
        }

        // Ultimate fail safe
        try {
            $response->prepareResponse();
        } catch (\Exception $e) {
            $this->log(LogLevel::CRITICAL, $e->getMessage(), ['exception' => $e]);
            return $this->createFailSafeResponse();
        }

        return $response;
    }
public function go ( ) { $ response = $ this -> getResponse ( ) ; try { $ request = $ this -> getRequest ( ) ; $ response -> setWriterFactory ( $ this -> getWriterFactory ( ) ) ; $ response -> setRequest ( $ request ) ; $ response -> setBodyData ( $ this -> getRouter ( ) -> processRequest ( $ this -> getRequest ( ) , $ this -> controller ) ) ; $ response -> setStatus ( $ this -> controller -> getStatus ( ) ) ; } catch ( AyeAyeException $ e ) { $ this -> log ( LogLevel :: INFO , $ e -> getPublicMessage ( ) ) ; $ this -> log ( LogLevel :: ERROR , $ e -> getMessage ( ) , [ 'exception' => $ e ] ) ; $ response -> setBodyData ( $ e -> getPublicMessage ( ) ) ; $ response -> setStatus ( new Status ( $ e -> getCode ( ) ) ) ; } catch ( \ Exception $ e ) { $ status = new Status ( 500 ) ; $ this -> log ( LogLevel :: CRITICAL , $ e -> getMessage ( ) , [ 'exception' => $ e ] ) ; $ response -> setBodyData ( $ status -> getMessage ( ) ) ; $ response -> setStatus ( $ status ) ; } // Ultimate fail safe try { $ response -> prepareResponse ( ) ; } catch ( \ Exception $ e ) { $ this -> log ( LogLevel :: CRITICAL , $ e -> getMessage ( ) , [ 'exception' => $ e ] ) ; return $ this -> createFailSafeResponse ( ) ; } return $ response ; }
Process the request, get a response and return it.

Exceptions thrown in most places will be handled here.
Currently there's no nice way to handle exceptions in Response::respond

@return Response
@SuppressWarnings(PHPMD.ShortMethodName)
Process the request get a response and return it .