# Handle and catch Ecto errors / exceptions

**URL:** <https://forum.elixirforum.com/t/handle-and-catch-ecto-errors-exceptions/48835>\
**Category:** Questions\
**Tags:** ecto, troubleshooting, exceptions\
**Created:** [July 8, 2022, 2:42pm UTC](https://forum.elixirforum.com/t/handle-and-catch-ecto-errors-exceptions/48835 "2022-07-08T14:42:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![al2o3cr](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/al2o3cr/32/3457_2.png) [@al2o3cr](https://forum.elixirforum.com/u/al2o3cr)\
**Post date:** [July 8, 2022, 7:23pm UTC](https://forum.elixirforum.com/t/handle-and-catch-ecto-errors-exceptions/48835/2 "2022-07-08T19:23:14Z")

</div>

> [@xgeek116](#):
>
> this the result of Inspect

The output you posted looks like what would happen if the _caller_ of `list_books` tried to use the `CastError` where it expected a list, something like:

```elixir
Enum.each(list_books(filters), fn book -> ... end)

```

since `IO.inspect` returns its argument.

---

_[View the full topic](https://forum.elixirforum.com/t/handle-and-catch-ecto-errors-exceptions/48835)._
