@@ -3316,6 +3316,64 @@ Defines the kind of workflow that is going to be created, which can be either
3316
3316
a normal workflow or a state machine. Read :doc: `this article </workflow/workflow-and-state-machine >`
3317
3317
to know their differences.
3318
3318
3319
+ .. _reference-workflows-exceptions :
3320
+
3321
+ exceptions
3322
+ """"
3323
+
3324
+ **type **: ``array ``
3325
+
3326
+ Defines what ``log_level `` and ``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
+ <exception id =" Symfony\Component\HttpKernel\Exception\BadRequestHttpException" >
3353
+ <framework : log_level >debug</framework : log_level >
3354
+ <framework : status_code >422</framework : status_code >
3355
+ </exception >
3356
+ </framework : exceptions >
3357
+ <!-- ... -->
3358
+ </framework : config >
3359
+ </container >
3360
+
3361
+ .. code-block :: php
3362
+
3363
+ // config/packages/exceptions.php
3364
+ use Symfony\Config\FrameworkConfig;
3365
+
3366
+ return static function (FrameworkConfig $framework) {
3367
+ $framework
3368
+ ->exceptions('Symfony\Component\HttpKernel\Exception\BadRequestHttpException')
3369
+ ->log_level('debug');
3370
+
3371
+ $framework
3372
+ ->exceptions('Symfony\Component\HttpKernel\Exception\BadRequestHttpException')
3373
+ ->status_code(422);
3374
+ ;
3375
+ };
3376
+
3319
3377
.. _`HTTP Host header attacks` : https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
3320
3378
.. _`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
3321
3379
.. _`Doctrine Cache` : https://www.doctrine-project.org/projects/doctrine-cache/en/current/index.html
0 commit comments