Skip to content

Commit 0074c4b

Browse files
committed
15874 add note about importance off order
1 parent 3cd7b53 commit 0074c4b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

reference/configuration/framework.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3372,6 +3372,24 @@ Defines what ``log_level`` and ``status_code`` should be returned by exception c
33723372
;
33733373
};
33743374
3375+
.. note::
3376+
3377+
When defining exceptions the order is important as it will use the first exception that matches ``instanceof``
3378+
3379+
Example with ``\RuntimeException`` and ``\Exception``:
3380+
3381+
.. code-block:: yaml
3382+
3383+
# config/packages/exceptions.yaml
3384+
framework:
3385+
exceptions:
3386+
Exception:
3387+
log_level: debug
3388+
status_code: 404
3389+
RuntimeException: # This will never be used as \RuntimeException extends \Exception
3390+
log_level: debug
3391+
status_code: 422
3392+
33753393
.. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
33763394
.. _`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
33773395
.. _`Doctrine Cache`: https://www.doctrine-project.org/projects/doctrine-cache/en/current/index.html

0 commit comments

Comments
 (0)