# New HTTP Exceptions

**URL:** <https://discourse.slimframework.com/t/new-http-exceptions/5961>\
**Category:** Questions\
**Created:** [July 29, 2024, 4:49pm UTC](https://discourse.slimframework.com/t/new-http-exceptions/5961 "2024-07-29T16:49:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![EgorKa](https://avatars.discourse-cdn.com/v4/letter/e/94ad74/32.png) [@EgorKa](https://discourse.slimframework.com/u/EgorKa)\
**Post date:** [July 29, 2024, 4:49pm UTC](https://discourse.slimframework.com/t/new-http-exceptions/5961/1 "2024-07-29T16:49:21Z")

</div>

Hello!

[https://www.slimframework.com/docs/v4/middleware/error-handling.html#new-http-exceptions](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.

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [July 29, 2024, 4:52pm UTC](https://discourse.slimframework.com/t/new-http-exceptions/5961/2 "2024-07-29T16:52:24Z")

</div>

Hi!

You can throw these kind of HTTP exceptions like this:

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

throw new HttpNotFoundException($request);

```

Make sure to pass the $request object.

---

<div class="post-metadata">

**Author:** ![EgorKa](https://avatars.discourse-cdn.com/v4/letter/e/94ad74/32.png) [@EgorKa](https://discourse.slimframework.com/u/EgorKa)\
**Post date:** [July 29, 2024, 6:00pm UTC](https://discourse.slimframework.com/t/new-http-exceptions/5961/3 "2024-07-29T18:00:14Z")

</div>

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