I was a bit confused by getting:
** (Ecto.NoResultsError) expected at least one result but got none in query:
When I queried for a non existent id like so:
product = Repo.get!(Product, id)
phoenix_ecto implements a protocol that should return a 404 instead.
defimpl Plug.Exception, for: Ecto.NoResultsError do def status(_), do: 404 end
Turns out that its only used in the
prod environment. If you want to see how it works in
dev you need to set
debug_errors: false in your
Though setting that you'll lose all the pretty errors. But nice to know if you want to look at something similar to production environment.