My problem is the following:
throw new HttpException(422, "some message")
doesn't work in Controllers.
However, throw new HttpException(404, "some message")
works, as well as 400 (etc.)
Why can't I throw an HttpException
with a 422 HTTP status code?
When I try to, I get a [200] response with the following debug info:
Fatal error: Uncaught exception 'ErrorException' with message 'Notice: Undefined offset: 422 in app\cache\dev\classes.php line 3079' in vendor\symfony\src\Symfony\Component\HttpKernel\Debug\ErrorHandler.php on line 67
( ! ) ErrorException: Notice: Undefined offset: 422 in app\cache\dev\classes.php line 3079 in vendor\symfony\src\Symfony\Component\HttpKernel\Debug\ErrorHandler.php on line 67
(I use FOSRESTBundle if it counts... and of course I cleared the cache)