New HTTP Exceptions

Hello!

https://www.slimframework.com/docs/v4/middleware/error-handling.html#new-http-exceptions

I don’t understand what to do with these classes. There are no examples. How to use them? Please help me.

Hi!

You can throw these kind of HTTP exceptions like this:

use Slim\Exception\HttpNotFoundException;
// ...

throw new HttpNotFoundException($request);

Make sure to pass the $request object.

Thanks, odan! :slightly_smiling_face: But I think a lot more examples should be added to the guide than there are now. :upside_down_face: