Rename ErrorCatcher to ErrorRenderer (rendering part only)
This commit is contained in:
parent
d3c17f2ade
commit
fb5b0429b2
@ -154,7 +154,7 @@ class FrameworkExtension extends Extension
|
|||||||
$loader->load('web.xml');
|
$loader->load('web.xml');
|
||||||
$loader->load('services.xml');
|
$loader->load('services.xml');
|
||||||
$loader->load('fragment_renderer.xml');
|
$loader->load('fragment_renderer.xml');
|
||||||
$loader->load('error_catcher.xml');
|
$loader->load('error_renderer.xml');
|
||||||
|
|
||||||
if (interface_exists(PsrEventDispatcherInterface::class)) {
|
if (interface_exists(PsrEventDispatcherInterface::class)) {
|
||||||
$container->setAlias(PsrEventDispatcherInterface::class, 'event_dispatcher');
|
$container->setAlias(PsrEventDispatcherInterface::class, 'event_dispatcher');
|
||||||
|
@ -33,7 +33,7 @@ use Symfony\Component\Debug\ErrorHandler;
|
|||||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\RegisterReverseContainerPass;
|
use Symfony\Component\DependencyInjection\Compiler\RegisterReverseContainerPass;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\ErrorCatcher\DependencyInjection\ErrorCatcherPass;
|
use Symfony\Component\ErrorRenderer\DependencyInjection\ErrorRendererPass;
|
||||||
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
|
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
|
||||||
use Symfony\Component\Form\DependencyInjection\FormPass;
|
use Symfony\Component\Form\DependencyInjection\FormPass;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@ -91,7 +91,7 @@ class FrameworkBundle extends Bundle
|
|||||||
KernelEvents::FINISH_REQUEST,
|
KernelEvents::FINISH_REQUEST,
|
||||||
];
|
];
|
||||||
|
|
||||||
$container->addCompilerPass(new ErrorCatcherPass());
|
$container->addCompilerPass(new ErrorRendererPass());
|
||||||
$container->addCompilerPass(new LoggerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
|
$container->addCompilerPass(new LoggerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
|
||||||
$container->addCompilerPass(new RegisterControllerArgumentLocatorsPass());
|
$container->addCompilerPass(new RegisterControllerArgumentLocatorsPass());
|
||||||
$container->addCompilerPass(new RemoveEmptyControllerArgumentLocatorsPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
$container->addCompilerPass(new RemoveEmptyControllerArgumentLocatorsPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<argument type="service" id="debug.file_link_formatter" />
|
<argument type="service" id="debug.file_link_formatter" />
|
||||||
<argument>%kernel.debug%</argument>
|
<argument>%kernel.debug%</argument>
|
||||||
<argument>%kernel.charset%</argument>
|
<argument>%kernel.charset%</argument>
|
||||||
<argument type="service" id="error_catcher.error_formatter" on-invalid="null" />
|
<argument type="service" id="error_renderer" on-invalid="null" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="debug.file_link_formatter" class="Symfony\Component\HttpKernel\Debug\FileLinkFormatter">
|
<service id="debug.file_link_formatter" class="Symfony\Component\HttpKernel\Debug\FileLinkFormatter">
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" ?>
|
|
||||||
|
|
||||||
<container xmlns="http://symfony.com/schema/dic/services"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
|
|
||||||
|
|
||||||
<services>
|
|
||||||
<service id="error_catcher.error_formatter" class="Symfony\Component\ErrorCatcher\DependencyInjection\LazyLoadingErrorFormatter">
|
|
||||||
<argument /> <!-- error renderer locator -->
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service id="error_catcher.renderer.html" class="Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer">
|
|
||||||
<tag name="error_catcher.renderer" />
|
|
||||||
<argument>%kernel.debug%</argument>
|
|
||||||
<argument>%kernel.charset%</argument>
|
|
||||||
<argument>%debug.file_link_format%</argument>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service id="error_catcher.renderer.json" class="Symfony\Component\ErrorCatcher\ErrorRenderer\JsonErrorRenderer">
|
|
||||||
<tag name="error_catcher.renderer" />
|
|
||||||
<argument>%kernel.debug%</argument>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service id="error_catcher.renderer.xml" class="Symfony\Component\ErrorCatcher\ErrorRenderer\XmlErrorRenderer">
|
|
||||||
<tag name="error_catcher.renderer" format="atom" />
|
|
||||||
<tag name="error_catcher.renderer" />
|
|
||||||
<argument>%kernel.debug%</argument>
|
|
||||||
<argument>%kernel.charset%</argument>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<service id="error_catcher.renderer.txt" class="Symfony\Component\ErrorCatcher\ErrorRenderer\TxtErrorRenderer">
|
|
||||||
<tag name="error_catcher.renderer" />
|
|
||||||
<argument>%kernel.debug%</argument>
|
|
||||||
<argument>%kernel.charset%</argument>
|
|
||||||
</service>
|
|
||||||
</services>
|
|
||||||
</container>
|
|
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
|
||||||
|
<container xmlns="http://symfony.com/schema/dic/services"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||||
|
|
||||||
|
<services>
|
||||||
|
<service id="error_renderer" class="Symfony\Component\ErrorRenderer\DependencyInjection\LazyLoadingErrorRenderer">
|
||||||
|
<argument /> <!-- error renderer locator -->
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service id="error_renderer.renderer.html" class="Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer">
|
||||||
|
<tag name="error_renderer.renderer" />
|
||||||
|
<argument>%kernel.debug%</argument>
|
||||||
|
<argument>%kernel.charset%</argument>
|
||||||
|
<argument>%debug.file_link_format%</argument>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service id="error_renderer.renderer.json" class="Symfony\Component\ErrorRenderer\ErrorRenderer\JsonErrorRenderer">
|
||||||
|
<tag name="error_renderer.renderer" />
|
||||||
|
<argument>%kernel.debug%</argument>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service id="error_renderer.renderer.xml" class="Symfony\Component\ErrorRenderer\ErrorRenderer\XmlErrorRenderer">
|
||||||
|
<tag name="error_renderer.renderer" format="atom" />
|
||||||
|
<tag name="error_renderer.renderer" />
|
||||||
|
<argument>%kernel.debug%</argument>
|
||||||
|
<argument>%kernel.charset%</argument>
|
||||||
|
</service>
|
||||||
|
|
||||||
|
<service id="error_renderer.renderer.txt" class="Symfony\Component\ErrorRenderer\ErrorRenderer\TxtErrorRenderer">
|
||||||
|
<tag name="error_renderer.renderer" />
|
||||||
|
<argument>%kernel.debug%</argument>
|
||||||
|
<argument>%kernel.charset%</argument>
|
||||||
|
</service>
|
||||||
|
</services>
|
||||||
|
</container>
|
@ -21,7 +21,7 @@
|
|||||||
"symfony/cache": "^4.4|^5.0",
|
"symfony/cache": "^4.4|^5.0",
|
||||||
"symfony/config": "^4.2|^5.0",
|
"symfony/config": "^4.2|^5.0",
|
||||||
"symfony/dependency-injection": "^4.4|^5.0",
|
"symfony/dependency-injection": "^4.4|^5.0",
|
||||||
"symfony/error-catcher": "^4.4|^5.0",
|
"symfony/error-renderer": "^4.4|^5.0",
|
||||||
"symfony/http-foundation": "^4.3|^5.0",
|
"symfony/http-foundation": "^4.3|^5.0",
|
||||||
"symfony/http-kernel": "^4.4|^5.0",
|
"symfony/http-kernel": "^4.4|^5.0",
|
||||||
"symfony/polyfill-mbstring": "~1.0",
|
"symfony/polyfill-mbstring": "~1.0",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\TwigBundle\Controller;
|
namespace Symfony\Bundle\TwigBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\TwigBundle\Controller;
|
namespace Symfony\Bundle\TwigBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ class ExceptionListenerPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
// register the exception controller only if Twig is enabled and required dependencies do exist
|
// register the exception controller only if Twig is enabled and required dependencies do exist
|
||||||
if (!class_exists('Symfony\Component\ErrorCatcher\Exception\FlattenException') || !interface_exists('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
|
if (!class_exists('Symfony\Component\ErrorRenderer\Exception\FlattenException') || !interface_exists('Symfony\Component\EventDispatcher\EventSubscriberInterface')) {
|
||||||
$container->removeDefinition('twig.exception_listener');
|
$container->removeDefinition('twig.exception_listener');
|
||||||
} elseif ($container->hasParameter('templating.engines')) {
|
} elseif ($container->hasParameter('templating.engines')) {
|
||||||
$engines = $container->getParameter('templating.engines');
|
$engines = $container->getParameter('templating.engines');
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\TwigBundle\Tests\Controller;
|
|||||||
|
|
||||||
use Symfony\Bundle\TwigBundle\Controller\ExceptionController;
|
use Symfony\Bundle\TwigBundle\Controller\ExceptionController;
|
||||||
use Symfony\Bundle\TwigBundle\Tests\TestCase;
|
use Symfony\Bundle\TwigBundle\Tests\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use Twig\Loader\ArrayLoader;
|
use Twig\Loader\ArrayLoader;
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Bundle\TwigBundle\Tests\Controller;
|
|||||||
|
|
||||||
use Symfony\Bundle\TwigBundle\Controller\PreviewErrorController;
|
use Symfony\Bundle\TwigBundle\Controller\PreviewErrorController;
|
||||||
use Symfony\Bundle\TwigBundle\Tests\TestCase;
|
use Symfony\Bundle\TwigBundle\Tests\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.1.3",
|
"php": "^7.1.3",
|
||||||
"symfony/error-catcher": "^4.4|^5.0",
|
"symfony/error-renderer": "^4.4|^5.0",
|
||||||
"symfony/twig-bridge": "^4.4|^5.0",
|
"symfony/twig-bridge": "^4.4|^5.0",
|
||||||
"symfony/http-foundation": "^4.3|^5.0",
|
"symfony/http-foundation": "^4.3|^5.0",
|
||||||
"symfony/http-kernel": "^4.4|^5.0",
|
"symfony/http-kernel": "^4.4|^5.0",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\WebProfilerBundle\Controller;
|
namespace Symfony\Bundle\WebProfilerBundle\Controller;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
|
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
|
||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<argument type="service" id="twig" />
|
<argument type="service" id="twig" />
|
||||||
<argument>%kernel.debug%</argument>
|
<argument>%kernel.debug%</argument>
|
||||||
<argument type="service" id="debug.file_link_formatter" />
|
<argument type="service" id="debug.file_link_formatter" />
|
||||||
<argument type="service" id="error_catcher.renderer.html" on-invalid="null" />
|
<argument type="service" id="error_renderer.renderer.html" on-invalid="null" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="web_profiler.csp.handler" class="Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler">
|
<service id="web_profiler.csp.handler" class="Symfony\Bundle\WebProfilerBundle\Csp\ContentSecurityPolicyHandler">
|
||||||
|
@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\Container;
|
|||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Definition;
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
|
||||||
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
|
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class WebProfilerExtensionTest extends TestCase
|
|||||||
$this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock();
|
$this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock();
|
||||||
|
|
||||||
$this->container = new ContainerBuilder();
|
$this->container = new ContainerBuilder();
|
||||||
$this->container->register('error_catcher.renderer.html', HtmlErrorRenderer::class);
|
$this->container->register('error_renderer.renderer.html', HtmlErrorRenderer::class);
|
||||||
$this->container->register('event_dispatcher', EventDispatcher::class)->setPublic(true);
|
$this->container->register('event_dispatcher', EventDispatcher::class)->setPublic(true);
|
||||||
$this->container->register('router', $this->getMockClass('Symfony\\Component\\Routing\\RouterInterface'))->setPublic(true);
|
$this->container->register('router', $this->getMockClass('Symfony\\Component\\Routing\\RouterInterface'))->setPublic(true);
|
||||||
$this->container->register('twig', 'Twig\Environment')->setPublic(true);
|
$this->container->register('twig', 'Twig\Environment')->setPublic(true);
|
||||||
|
@ -4,7 +4,7 @@ CHANGELOG
|
|||||||
4.4.0
|
4.4.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* deprecated `FlattenException`, use the `FlattenException` of the `ErrorCatcher` component
|
* deprecated `FlattenException`, use the `FlattenException` of the `ErrorRenderer` component
|
||||||
|
|
||||||
4.3.0
|
4.3.0
|
||||||
-----
|
-----
|
||||||
|
@ -14,7 +14,7 @@ namespace Symfony\Component\Debug\Exception;
|
|||||||
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
|
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
|
||||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||||
|
|
||||||
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorCatcher\Exception\FlattenException" instead.', FlattenException::class), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorRenderer\Exception\FlattenException" instead.', FlattenException::class), E_USER_DEPRECATED);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FlattenException wraps a PHP Error or Exception to be able to serialize it.
|
* FlattenException wraps a PHP Error or Exception to be able to serialize it.
|
||||||
@ -23,7 +23,7 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
|||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
*
|
*
|
||||||
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorCatcher\Exception\FlattenException instead.
|
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorRenderer\Exception\FlattenException instead.
|
||||||
*/
|
*/
|
||||||
class FlattenException
|
class FlattenException
|
||||||
{
|
{
|
||||||
@ -39,11 +39,11 @@ class FlattenException
|
|||||||
private $line;
|
private $line;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorCatcher\Exception::createFromThrowable() instead.
|
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorRenderer\Exception::createFromThrowable() instead.
|
||||||
*/
|
*/
|
||||||
public static function create(\Exception $exception, $statusCode = null, array $headers = [])
|
public static function create(\Exception $exception, $statusCode = null, array $headers = [])
|
||||||
{
|
{
|
||||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use Symfony\Component\ErrorCatcher\Exception::createFromThrowable() instead.', __METHOD__), E_USER_DEPRECATED);
|
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.4, use Symfony\Component\ErrorRenderer\Exception::createFromThrowable() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||||
|
|
||||||
return static::createFromThrowable($exception, $statusCode, $headers);
|
return static::createFromThrowable($exception, $statusCode, $headers);
|
||||||
}
|
}
|
||||||
|
@ -9,23 +9,23 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\DependencyInjection;
|
namespace Symfony\Component\ErrorRenderer\DependencyInjection;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||||
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
|
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorRendererInterface;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\ErrorRendererInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
||||||
*/
|
*/
|
||||||
class ErrorCatcherPass implements CompilerPassInterface
|
class ErrorRendererPass implements CompilerPassInterface
|
||||||
{
|
{
|
||||||
private $rendererService;
|
private $rendererService;
|
||||||
private $rendererTag;
|
private $rendererTag;
|
||||||
|
|
||||||
public function __construct(string $rendererService = 'error_catcher.error_formatter', string $rendererTag = 'error_catcher.renderer')
|
public function __construct(string $rendererService = 'error_renderer', string $rendererTag = 'error_renderer.renderer')
|
||||||
{
|
{
|
||||||
$this->rendererService = $rendererService;
|
$this->rendererService = $rendererService;
|
||||||
$this->rendererTag = $rendererTag;
|
$this->rendererTag = $rendererTag;
|
@ -9,17 +9,17 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\DependencyInjection;
|
namespace Symfony\Component\ErrorRenderer\DependencyInjection;
|
||||||
|
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorFormatter;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lazily loads error renderers from the dependency injection container.
|
* Lazily loads error renderers from the dependency injection container.
|
||||||
*
|
*
|
||||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
||||||
*/
|
*/
|
||||||
class LazyLoadingErrorFormatter extends ErrorFormatter
|
class LazyLoadingErrorRenderer extends ErrorRenderer
|
||||||
{
|
{
|
||||||
private $container;
|
private $container;
|
||||||
private $initialized = [];
|
private $initialized = [];
|
@ -9,10 +9,11 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\ErrorRendererNotFoundException;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\ErrorRendererInterface;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\ErrorRendererNotFoundException;
|
||||||
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats an exception to be used as response content.
|
* Formats an exception to be used as response content.
|
||||||
@ -23,7 +24,7 @@ use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
|||||||
*
|
*
|
||||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
||||||
*/
|
*/
|
||||||
class ErrorFormatter
|
class ErrorRenderer
|
||||||
{
|
{
|
||||||
private $renderers = [];
|
private $renderers = [];
|
||||||
|
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for classes that can render errors in a specific format.
|
* Interface for classes that can render errors in a specific format.
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
|
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
|
||||||
|
|
||||||
/**
|
/**
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
@ -9,9 +9,9 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\ErrorRenderer;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Exception;
|
namespace Symfony\Component\ErrorRenderer\Exception;
|
||||||
|
|
||||||
class ErrorRendererNotFoundException extends \RuntimeException
|
class ErrorRendererNotFoundException extends \RuntimeException
|
||||||
{
|
{
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Exception;
|
namespace Symfony\Component\ErrorRenderer\Exception;
|
||||||
|
|
||||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||||
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
|
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
|
@ -1,7 +1,7 @@
|
|||||||
ErrorCatcher Component
|
ErrorRenderer Component
|
||||||
======================
|
======================
|
||||||
|
|
||||||
The ErrorCatcher component provides tools to manage and display errors and exceptions.
|
The ErrorRenderer component provides tools to display errors and exceptions.
|
||||||
|
|
||||||
Resources
|
Resources
|
||||||
---------
|
---------
|
@ -9,42 +9,42 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Tests\DependencyInjection;
|
namespace Symfony\Component\ErrorRenderer\Tests\DependencyInjection;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\DependencyInjection\Reference;
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
use Symfony\Component\DependencyInjection\ServiceLocator;
|
use Symfony\Component\DependencyInjection\ServiceLocator;
|
||||||
use Symfony\Component\ErrorCatcher\DependencyInjection\ErrorCatcherPass;
|
use Symfony\Component\ErrorRenderer\DependencyInjection\ErrorRendererPass;
|
||||||
use Symfony\Component\ErrorCatcher\DependencyInjection\LazyLoadingErrorFormatter;
|
use Symfony\Component\ErrorRenderer\DependencyInjection\LazyLoadingErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\JsonErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\JsonErrorRenderer;
|
||||||
|
|
||||||
class ErrorCatcherPassTest extends TestCase
|
class ErrorRendererPassTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testProcess()
|
public function testProcess()
|
||||||
{
|
{
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
$container->setParameter('kernel.debug', true);
|
$container->setParameter('kernel.debug', true);
|
||||||
$definition = $container->register('error_catcher.error_formatter', LazyLoadingErrorFormatter::class)
|
$definition = $container->register('error_renderer', LazyLoadingErrorRenderer::class)
|
||||||
->addArgument([])
|
->addArgument([])
|
||||||
;
|
;
|
||||||
$container->register('error_catcher.renderer.html', HtmlErrorRenderer::class)
|
$container->register('error_renderer.renderer.html', HtmlErrorRenderer::class)
|
||||||
->addTag('error_catcher.renderer')
|
->addTag('error_renderer.renderer')
|
||||||
;
|
;
|
||||||
$container->register('error_catcher.renderer.json', JsonErrorRenderer::class)
|
$container->register('error_renderer.renderer.json', JsonErrorRenderer::class)
|
||||||
->addTag('error_catcher.renderer')
|
->addTag('error_renderer.renderer')
|
||||||
;
|
;
|
||||||
|
|
||||||
(new ErrorCatcherPass())->process($container);
|
(new ErrorRendererPass())->process($container);
|
||||||
|
|
||||||
$serviceLocatorDefinition = $container->getDefinition((string) $definition->getArgument(0));
|
$serviceLocatorDefinition = $container->getDefinition((string) $definition->getArgument(0));
|
||||||
$this->assertSame(ServiceLocator::class, $serviceLocatorDefinition->getClass());
|
$this->assertSame(ServiceLocator::class, $serviceLocatorDefinition->getClass());
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'html' => new ServiceClosureArgument(new Reference('error_catcher.renderer.html')),
|
'html' => new ServiceClosureArgument(new Reference('error_renderer.renderer.html')),
|
||||||
'json' => new ServiceClosureArgument(new Reference('error_catcher.renderer.json')),
|
'json' => new ServiceClosureArgument(new Reference('error_renderer.renderer.json')),
|
||||||
];
|
];
|
||||||
$this->assertEquals($expected, $serviceLocatorDefinition->getArgument(0));
|
$this->assertEquals($expected, $serviceLocatorDefinition->getArgument(0));
|
||||||
}
|
}
|
@ -9,18 +9,18 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Tests\DependencyInjection;
|
namespace Symfony\Component\ErrorRenderer\Tests\DependencyInjection;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Symfony\Component\ErrorCatcher\DependencyInjection\LazyLoadingErrorFormatter;
|
use Symfony\Component\ErrorRenderer\DependencyInjection\LazyLoadingErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorRendererInterface;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\ErrorRendererInterface;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
class LazyLoadingErrorFormatterTest extends TestCase
|
class LazyLoadingErrorRendererTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\ErrorCatcher\Exception\ErrorRendererNotFoundException
|
* @expectedException \Symfony\Component\ErrorRenderer\Exception\ErrorRendererNotFoundException
|
||||||
* @expectedExceptionMessage No error renderer found for format "foo".
|
* @expectedExceptionMessage No error renderer found for format "foo".
|
||||||
*/
|
*/
|
||||||
public function testInvalidErrorRenderer()
|
public function testInvalidErrorRenderer()
|
||||||
@ -29,7 +29,7 @@ class LazyLoadingErrorFormatterTest extends TestCase
|
|||||||
$container->expects($this->once())->method('has')->with('foo')->willReturn(false);
|
$container->expects($this->once())->method('has')->with('foo')->willReturn(false);
|
||||||
|
|
||||||
$exception = FlattenException::createFromThrowable(new \Exception('Foo'));
|
$exception = FlattenException::createFromThrowable(new \Exception('Foo'));
|
||||||
(new LazyLoadingErrorFormatter($container))->render($exception, 'foo');
|
(new LazyLoadingErrorRenderer($container))->render($exception, 'foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCustomErrorRenderer()
|
public function testCustomErrorRenderer()
|
||||||
@ -47,7 +47,7 @@ class LazyLoadingErrorFormatterTest extends TestCase
|
|||||||
->willReturn(new FooErrorRenderer())
|
->willReturn(new FooErrorRenderer())
|
||||||
;
|
;
|
||||||
|
|
||||||
$errorRenderer = new LazyLoadingErrorFormatter($container);
|
$errorRenderer = new LazyLoadingErrorRenderer($container);
|
||||||
|
|
||||||
$exception = FlattenException::createFromThrowable(new \RuntimeException('Foo'));
|
$exception = FlattenException::createFromThrowable(new \RuntimeException('Foo'));
|
||||||
$this->assertSame('Foo', $errorRenderer->render($exception, 'foo'));
|
$this->assertSame('Foo', $errorRenderer->render($exception, 'foo'));
|
@ -9,11 +9,11 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Tests\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\Tests\ErrorRenderer;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
class HtmlErrorRendererTest extends TestCase
|
class HtmlErrorRendererTest extends TestCase
|
||||||
{
|
{
|
@ -9,11 +9,11 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Tests\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\Tests\ErrorRenderer;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\JsonErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\JsonErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
class JsonErrorRendererTest extends TestCase
|
class JsonErrorRendererTest extends TestCase
|
||||||
{
|
{
|
@ -9,11 +9,11 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Tests\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\Tests\ErrorRenderer;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\TxtErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\TxtErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
class TxtErrorRendererTest extends TestCase
|
class TxtErrorRendererTest extends TestCase
|
||||||
{
|
{
|
@ -9,11 +9,11 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Tests\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\Tests\ErrorRenderer;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\XmlErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\XmlErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
class XmlErrorRendererTest extends TestCase
|
class XmlErrorRendererTest extends TestCase
|
||||||
{
|
{
|
@ -9,23 +9,23 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Tests\ErrorRenderer;
|
namespace Symfony\Component\ErrorRenderer\Tests;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorFormatter;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorRendererInterface;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\ErrorRendererInterface;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
|
|
||||||
class ErrorFormatterTest extends TestCase
|
class ErrorRendererTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\ErrorCatcher\Exception\ErrorRendererNotFoundException
|
* @expectedException \Symfony\Component\ErrorRenderer\Exception\ErrorRendererNotFoundException
|
||||||
* @expectedExceptionMessage No error renderer found for format "foo".
|
* @expectedExceptionMessage No error renderer found for format "foo".
|
||||||
*/
|
*/
|
||||||
public function testErrorRendererNotFound()
|
public function testErrorRendererNotFound()
|
||||||
{
|
{
|
||||||
$exception = FlattenException::createFromThrowable(new \Exception('foo'));
|
$exception = FlattenException::createFromThrowable(new \Exception('foo'));
|
||||||
(new ErrorFormatter([]))->render($exception, 'foo');
|
(new ErrorRenderer([]))->render($exception, 'foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -33,13 +33,13 @@ class ErrorFormatterTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testInvalidErrorRenderer()
|
public function testInvalidErrorRenderer()
|
||||||
{
|
{
|
||||||
new ErrorFormatter([new \stdClass()]);
|
new ErrorRenderer([new \stdClass()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCustomErrorRenderer()
|
public function testCustomErrorRenderer()
|
||||||
{
|
{
|
||||||
$renderers = [new FooErrorRenderer()];
|
$renderers = [new FooErrorRenderer()];
|
||||||
$errorRenderer = new ErrorFormatter($renderers);
|
$errorRenderer = new ErrorRenderer($renderers);
|
||||||
|
|
||||||
$exception = FlattenException::createFromThrowable(new \RuntimeException('Foo'));
|
$exception = FlattenException::createFromThrowable(new \RuntimeException('Foo'));
|
||||||
$this->assertSame('Foo', $errorRenderer->render($exception, 'foo'));
|
$this->assertSame('Foo', $errorRenderer->render($exception, 'foo'));
|
@ -9,11 +9,11 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Component\ErrorCatcher\Tests\Exception;
|
namespace Symfony\Component\ErrorRenderer\Tests\Exception;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
|
||||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "symfony/error-catcher",
|
"name": "symfony/error-renderer",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"description": "Symfony ErrorCatcher Component",
|
"description": "Symfony ErrorRenderer Component",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"symfony/http-kernel": "<4.4"
|
"symfony/http-kernel": "<4.4"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": { "Symfony\\Component\\ErrorCatcher\\": "" },
|
"psr-4": { "Symfony\\Component\\ErrorRenderer\\": "" },
|
||||||
"exclude-from-classmap": [
|
"exclude-from-classmap": [
|
||||||
"/Tests/"
|
"/Tests/"
|
||||||
]
|
]
|
@ -13,7 +13,7 @@
|
|||||||
</php>
|
</php>
|
||||||
|
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Symfony ErrorCatcher Component Test Suite">
|
<testsuite name="Symfony ErrorRenderer Component Test Suite">
|
||||||
<directory>./Tests/</directory>
|
<directory>./Tests/</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\HttpKernel\DataCollector;
|
namespace Symfony\Component\HttpKernel\DataCollector;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@ use Symfony\Component\Console\Event\ConsoleEvent;
|
|||||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||||
use Symfony\Component\Debug\ErrorHandler;
|
use Symfony\Component\Debug\ErrorHandler;
|
||||||
use Symfony\Component\Debug\ExceptionHandler;
|
use Symfony\Component\Debug\ExceptionHandler;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\ErrorFormatter;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\ErrorRenderer\HtmlErrorRenderer;
|
use Symfony\Component\ErrorRenderer\ErrorRenderer\HtmlErrorRenderer;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\ErrorRendererNotFoundException;
|
use Symfony\Component\ErrorRenderer\Exception\ErrorRendererNotFoundException;
|
||||||
use Symfony\Component\EventDispatcher\Event;
|
use Symfony\Component\EventDispatcher\Event;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
@ -46,7 +46,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
|||||||
private $fileLinkFormat;
|
private $fileLinkFormat;
|
||||||
private $scope;
|
private $scope;
|
||||||
private $charset;
|
private $charset;
|
||||||
private $errorFormatter;
|
private $errorRenderer;
|
||||||
private $firstCall = true;
|
private $firstCall = true;
|
||||||
private $hasTerminatedWithException;
|
private $hasTerminatedWithException;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
|||||||
* @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files
|
* @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files
|
||||||
* @param bool $scope Enables/disables scoping mode
|
* @param bool $scope Enables/disables scoping mode
|
||||||
*/
|
*/
|
||||||
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, string $charset = null, ErrorFormatter $errorFormatter = null)
|
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = E_ALL, ?int $throwAt = E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, string $charset = null, ErrorRenderer $errorRenderer = null)
|
||||||
{
|
{
|
||||||
$this->exceptionHandler = $exceptionHandler;
|
$this->exceptionHandler = $exceptionHandler;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
@ -69,7 +69,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
|||||||
$this->fileLinkFormat = $fileLinkFormat;
|
$this->fileLinkFormat = $fileLinkFormat;
|
||||||
$this->scope = $scope;
|
$this->scope = $scope;
|
||||||
$this->charset = $charset;
|
$this->charset = $charset;
|
||||||
$this->errorFormatter = $errorFormatter;
|
$this->errorRenderer = $errorRenderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,16 +167,16 @@ class DebugHandlersListener implements EventSubscriberInterface
|
|||||||
|
|
||||||
$debug = $this->scream && $this->scope;
|
$debug = $this->scream && $this->scope;
|
||||||
$controller = function (Request $request) use ($debug) {
|
$controller = function (Request $request) use ($debug) {
|
||||||
if (null === $this->errorFormatter) {
|
if (null === $this->errorRenderer) {
|
||||||
$this->errorFormatter = new ErrorFormatter([new HtmlErrorRenderer($debug, $this->charset, $this->fileLinkFormat)]);
|
$this->errorRenderer = new ErrorRenderer([new HtmlErrorRenderer($debug, $this->charset, $this->fileLinkFormat)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$e = $request->attributes->get('exception');
|
$e = $request->attributes->get('exception');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new Response($this->errorFormatter->render($e, $request->getPreferredFormat()), $e->getStatusCode(), $e->getHeaders());
|
return new Response($this->errorRenderer->render($e, $request->getPreferredFormat()), $e->getStatusCode(), $e->getHeaders());
|
||||||
} catch (ErrorRendererNotFoundException $_) {
|
} catch (ErrorRendererNotFoundException $_) {
|
||||||
return new Response($this->errorFormatter->render($e), $e->getStatusCode(), $e->getHeaders());
|
return new Response($this->errorRenderer->render($e), $e->getStatusCode(), $e->getHeaders());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\HttpKernel\EventListener;
|
namespace Symfony\Component\HttpKernel\EventListener;
|
||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
|
namespace Symfony\Component\HttpKernel\Tests\DataCollector;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector;
|
use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": "^7.1.3",
|
"php": "^7.1.3",
|
||||||
"symfony/debug": "^4.4|^5.0",
|
"symfony/debug": "^4.4|^5.0",
|
||||||
"symfony/error-catcher": "^4.4|^5.0",
|
"symfony/error-renderer": "^4.4|^5.0",
|
||||||
"symfony/event-dispatcher": "^4.3",
|
"symfony/event-dispatcher": "^4.3",
|
||||||
"symfony/http-foundation": "^4.4|^5.0",
|
"symfony/http-foundation": "^4.4|^5.0",
|
||||||
"symfony/polyfill-ctype": "^1.8",
|
"symfony/polyfill-ctype": "^1.8",
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
namespace Symfony\Component\Messenger\EventListener;
|
namespace Symfony\Component\Messenger\EventListener;
|
||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
|
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
|
||||||
use Symfony\Component\Messenger\Exception\HandlerFailedException;
|
use Symfony\Component\Messenger\Exception\HandlerFailedException;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Messenger\Stamp;
|
namespace Symfony\Component\Messenger\Stamp;
|
||||||
|
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\Messenger\Envelope;
|
use Symfony\Component\Messenger\Envelope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\Messenger\Tests\Stamp;
|
namespace Symfony\Component\Messenger\Tests\Stamp;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\ErrorCatcher\Exception\FlattenException;
|
use Symfony\Component\ErrorRenderer\Exception\FlattenException;
|
||||||
use Symfony\Component\Messenger\Stamp\RedeliveryStamp;
|
use Symfony\Component\Messenger\Stamp\RedeliveryStamp;
|
||||||
|
|
||||||
class RedeliveryStampTest extends TestCase
|
class RedeliveryStampTest extends TestCase
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"doctrine/persistence": "~1.0",
|
"doctrine/persistence": "~1.0",
|
||||||
"symfony/console": "^3.4|^4.0|^5.0",
|
"symfony/console": "^3.4|^4.0|^5.0",
|
||||||
"symfony/dependency-injection": "^3.4.19|^4.1.8|^5.0",
|
"symfony/dependency-injection": "^3.4.19|^4.1.8|^5.0",
|
||||||
"symfony/error-catcher": "^4.4|^5.0",
|
"symfony/error-renderer": "^4.4|^5.0",
|
||||||
"symfony/event-dispatcher": "^4.3|^5.0",
|
"symfony/event-dispatcher": "^4.3|^5.0",
|
||||||
"symfony/http-kernel": "^4.4|^5.0",
|
"symfony/http-kernel": "^4.4|^5.0",
|
||||||
"symfony/process": "^3.4|^4.0|^5.0",
|
"symfony/process": "^3.4|^4.0|^5.0",
|
||||||
|
@ -85,7 +85,7 @@ abstract class AbstractCloner implements ClonerInterface
|
|||||||
'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],
|
'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'],
|
||||||
'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'],
|
'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'],
|
||||||
'Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
'Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
||||||
'Symfony\Component\ErrorCatcher\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'],
|
'Symfony\Component\Debug\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'],
|
||||||
|
|
||||||
'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'],
|
'ProxyManager\Proxy\ProxyInterface' => ['Symfony\Component\VarDumper\Caster\ProxyManagerCaster', 'castProxy'],
|
||||||
'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
'PHPUnit_Framework_MockObject_MockObject' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'],
|
||||||
|
Reference in New Issue
Block a user