How to stop 500 errors when UUID doesn't match

To add to @Ankhers’s advice, @shahryarjb you can add a plug which would transform this particular ecto error into an http response which is more appropriate for your use case.

See Phoenix.NotAcceptableError - How can I return an error instead of having the app just have an exception?

defimpl Plug.Exception, for: Ecto.ChangeError do
  def status(_exception), do: 400
end
1 Like