Symfony ErrorHandler

Symfony ErrorHandler

In Symfony 4.4 the Debug component was replaced with the new ErrorHandler component. Let's have a quick look what changed and how you can use the component both in Symfony or standalone.

6a1345d8e6dd15b2c78eff0c331963b1?s=128

Denis Brumann

February 25, 2020
Tweet

Transcript

  1. Symfony Error Handler Denis Brumann ⚠ denis.brumann@sensiolabs.de ⁉ @dbrumann

  2. None
  3. None
  4. None
  5. None
  6. Throwable Error Exception

  7. Symfony\Component\ErrorHandler\ ErrorHandler::register()

  8. None
  9. None
  10. Symfony\Component\ErrorHandler\ DebugClassLoader::enable()

  11. None
  12. Rendering error pages

  13. Routing Configuration _errors: resource: '@FrameworkBundle/Resources/config/routing/errors.xml' prefix: /_error

  14. HTML JSON XML

  15. HTML JSON XML

  16. HTML JSON XML

  17. HTML JSON XML YAML

  18. ErrorRenderer

  19. Customizing Error Pages

  20. TwigBundle Resources

  21. Non-HTML Resources implements Symfony\Component\Serializer\Normalizer\ NormalizerInterface

  22. public function supportsNormalization($data, string $format = null) { return $data

    instanceof FlattenException; }
  23. None
  24. Symfony\Component\HttpKernel\ EventListener\ErrorListener Symfony\Component\Console\ EventListener\ErrorListener

  25. Symfony\Component\HttpKernel\ Controller\ErrorController

  26. Custom Error Controller

  27. HTML JSON XML Symfony\Component\Serializer\Normalizer\ NormalizerInterface

  28. HTML JSON XML composer require twig composer require serializer

  29. Docs https://symfony.com/doc/current/components/error_handler.html https://symfony.com/doc/current/controller/error_pages.html