@@ -3316,6 +3316,62 @@ Defines the kind of workflow that is going to be created, which can be either
33163316a normal workflow or a state machine. Read :doc: `this article </workflow/workflow-and-state-machine >`
33173317to know their differences.
33183318
3319+ .. _reference-workflows-exceptions :
3320+
3321+ exceptions
3322+ """"
3323+
3324+ **type **: ``array ``
3325+
3326+ Defines what ``log_level `` should be used and what ``status_code `` should be returned by exception class:
3327+
3328+ .. configuration-block ::
3329+
3330+ .. code-block :: yaml
3331+
3332+ # config/packages/exceptions.yaml
3333+ framework :
3334+ exceptions :
3335+ Symfony\Component\HttpKernel\Exception\BadRequestHttpException :
3336+ log_level : debug
3337+ status_code : 422
3338+
3339+ .. code-block :: xml
3340+
3341+ <!-- config/packages/exceptions.xml -->
3342+ <?xml version =" 1.0" encoding =" UTF-8" ?>
3343+ <container xmlns =" http://symfony.com/schema/dic/services"
3344+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3345+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
3346+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
3347+ https://symfony.com/schema/dic/services/services-1.0.xsd
3348+ http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
3349+
3350+ <framework : config >
3351+ <framework : exceptions >
3352+ <framework : Symfony \Component\HttpKernel\Exception\BadRequestHttpException log_level =" debug" status_code =" 422" >
3353+ </framework : Symfony \Component\HttpKernel\Exception\BadRequestHttpException>
3354+ </framework : exceptions >
3355+ <!-- ... -->
3356+ </framework : config >
3357+ </container >
3358+
3359+ .. code-block :: php
3360+
3361+ // config/packages/exceptions.php
3362+ use Symfony\Config\FrameworkConfig;
3363+
3364+ return static function (FrameworkConfig $framework) {
3365+ $framework
3366+ ->exceptions('Symfony\Component\HttpKernel\Exception\BadRequestHttpException')
3367+ ->log_level('debug');
3368+
3369+ $framework
3370+ ->exceptions('Symfony\Component\HttpKernel\Exception\BadRequestHttpException')
3371+ ->status_code(422);
3372+ ;
3373+ };
3374+
33193375 .. _`HTTP Host header attacks` : https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
33203376.. _`Security Advisory Blog post` : https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning
33213377.. _`Doctrine Cache` : https://www.doctrine-project.org/projects/doctrine-cache/en/current/index.html
0 commit comments