8000 Fix `framework.exceptions` XML and PHP configuration examples · symfony/symfony-docs@a540745 · GitHub
[go: up one dir, main page]

Skip to content

Commit a540745

Browse files
committed
Fix framework.exceptions XML and PHP configuration examples
1 parent dfc2982 commit a540745

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

reference/configuration/framework.rst

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,32 +3575,12 @@ exceptions that match the given exception class:
35753575
35763576
<framework:config>
35773577
<framework:exceptions>
3578-
<exception id="Symfony\Component\HttpKernel\Exception\BadRequestHttpException">
3579-
<framework:log_level>debug</framework:log_level>
3580-
<framework:status_code>422</framework:status_code>
3581-
</exception>
3578+
<framework:exception name="Symfony\Component\HttpKernel\Exception\BadRequestHttpException" log-level="info" status-code="422" />
35823579
</framework:exceptions>
35833580
<!-- ... -->
35843581
</framework:config>
35853582
</container>
35863583
3587-
.. code-block:: php
3588-
3589-
// config/packages/exceptions.php
3590-
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
3591-
use Symfony\Config\FrameworkConfig;
3592-
3593-
return static function (FrameworkConfig $framework) {
3594-
$framework
3595-
->exceptions(BadRequestHttpException::class)
3596-
->log_level('debug');
3597-
3598-
$framework
3599-
->exceptions(BadRequestHttpException::class)
3600-
->status_code(422);
3601-
;
3602-
};
3603-
36043584
The order in which you configure exceptions is important because Symfony will
36053585
use the configuration of the first exception that matches ``instanceof``:
36063586

0 commit comments

Comments
 (0)
0