Traverse_errors/2 not working with exclusion_constraint/3

I have a nested association in which I’ve put an exclusion constraint to prevent dates from overlapping. When the constraint is violated, Ecto returns a nice nested changeset describing the error:

{:error,
 #Ecto.Changeset<action: :insert,
  changes: %{plan_id: 8, user_sponsor_id: 1,
    user_sponsor_plan_schedule: [#Ecto.Changeset<action: :insert,
      changes: %{date_effective: ~D[2017-09-11],
        date_termination: ~D[2017-09-11]}, errors: [],
      data: #Storage.Schema.UserSponsorPlanSchedule<>, valid?: true>]},
  errors: [user_sponsor_plan: {"has already been taken", []}],
  data: #Storage.Schema.UserSponsorPlan<>, valid?: false>}

When I try to use traverse_errors/2 on this changeset it throws the following error:

** (ArgumentError) changeset does not have types information
    (ecto) lib/ecto/changeset.ex:2142: Ecto.Changeset.merge_related_keys/4

The exclusion_constraint/3 function accepts message, name and match as options. It looks like it won’t support setting a type, so I don’t see how these two can work together.

Does traverse_errors support an exclusion constraint?

I don’t see any exclusion or date errors in your changeset, and I think yes, traverse_errors does support exclusion constraints.

You’re correct it does work. It was a user error on my part.