private function getDebugTraceResponse(\Exception $exception, $statusCode)
    {
        $request = $this->application->getRequest();
        $response = (new \Symfony\Component\Debug\ExceptionHandler())->createResponse($exception);
        $response->setStatusCode($statusCode);

        if (in_array('application/json', $request->getAcceptableContentTypes())) {
            $response = new JsonResponse($response->getContent(), $response->getStatusCode(), $response->headers->all());
        }

        return $response;
    }
private function getDebugTraceResponse(\Exception $exception, $statusCode)
    {
        $request = $this->application->getRequest();
        $response = (new \Symfony\Component\Debug\ExceptionHandler())->createResponse($exception);
        $response->setStatusCode($statusCode);

        if (in_array('application/json', $request->getAcceptableContentTypes())) {
            $response = new JsonResponse($response->getContent(), $response->getStatusCode(), $response->headers->all());
        }

        return $response;
    }
private function getDebugTraceResponse ( \ Exception $ exception , $ statusCode ) { $ request = $ this -> application -> getRequest ( ) ; $ response = ( new \ Symfony \ Component \ Debug \ ExceptionHandler ( ) ) -> createResponse ( $ exception ) ; $ response -> setStatusCode ( $ statusCode ) ; if ( in_array ( 'application/json' , $ request -> getAcceptableContentTypes ( ) ) ) { $ response = new JsonResponse ( $ response -> getContent ( ) , $ response -> getStatusCode ( ) , $ response -> headers -> all ( ) ) ; } return $ response ; }
Return response with debug trace.

@param \Exception $exception
@param int        $statusCode

@return Response
Return response with debug trace .