|
@@ -16,6 +16,7 @@ use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
|
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
|
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
|
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|
use Symfony\Component\HttpKernel\Exception\FlattenException;
|
|
use Symfony\Component\HttpKernel\Exception\FlattenException;
|
|
|
|
+use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -63,6 +64,16 @@ class ExceptionListener
|
|
'format' => 0 === strncasecmp(PHP_SAPI, 'cli', 3) ? 'txt' : $request->getRequestFormat(),
|
|
'format' => 0 === strncasecmp(PHP_SAPI, 'cli', 3) ? 'txt' : $request->getRequestFormat(),
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+ $attributes += $exception instanceof HttpExceptionInterface ? array(
|
|
|
|
+ 'code' => $exception->getStatusCode(),
|
|
|
|
+ 'message' => $exception->getStatusMessage(),
|
|
|
|
+ 'headers' => $exception->getHeaders(),
|
|
|
|
+ ) : array(
|
|
|
|
+ 'code' => 500,
|
|
|
|
+ 'message' => 'Internal Server Error',
|
|
|
|
+ 'headers' => array(),
|
|
|
|
+ );
|
|
|
|
+
|
|
$request = $request->duplicate(null, null, $attributes);
|
|
$request = $request->duplicate(null, null, $attributes);
|
|
|
|
|
|
try {
|
|
try {
|