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.
defimpl Plug.Exception, for: Ecto.ChangeError do
def status(_exception), do: 400
end