From 230803157bfdcf9ad724010253dd912f5bca5fb3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 24 Apr 2018 15:07:17 +0200 Subject: [PATCH] Reword the explanation about HTTP exceptions --- controller.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/controller.rst b/controller.rst index 8809fb8ff7a..b70b6bb149e 100644 --- a/controller.rst +++ b/controller.rst @@ -307,9 +307,12 @@ method is just a shortcut to create a special :class:`Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException` object, which ultimately triggers a 404 HTTP response inside Symfony. -Of course, you're free to throw any ``Exception`` class in your controller - -Symfony will automatically return a 500 HTTP response code:: +If you throw an exception that extends or is an instance of +:class:`Symfony\\Component\\HttpKernel\\Exception\\HttpException`, Symfony will +use the appropriate HTTP status code. Otherwise, the response will have a 500 +HTTP status code:: + // this exception ultimately generates a 500 status error throw new \Exception('Something went wrong!'); In every case, an error page is shown to the end user and a full debug