Ecto Changeset Error

I’m getting the following exception for a failed changeset:

Process #PID<0.9321.1> raised an exception
** (MatchError) no match of right hand side value: {:error, #Ecto.Changeset<action: :update, changes: %{}, errors: [title: {"can't be blank", []}], data: #SlackCoder.Models.PR<>, valid?: false>}
    (slack_coder) lib/slack_coder/github/helper.ex:188: SlackCoder.Github.Helper.build_pr/2
    (slack_coder) lib/slack_coder/github/helper.ex:96: SlackCoder.Github.Helper._status/1
    (slack_coder) lib/slack_coder/github/helper.ex:86: anonymous fn/2 in SlackCoder.Github.Helper.status/1

What I’d like to know is more information about the schema data that failed validation. But I see here that it is hard coded not to display any information about the model:

If an Ecto.Schema had a default implementation for the inspect protocol just to display all the data, that line could instead just call inspect on the data and it would produce a more informative error message.

Is there any reason why this isn’t already the case?


@mgwidmann I think slightly better place to ask this sort of implementation question would be!forum/elixir-ecto where Ecto maintainers hang out more often :wink:

1 Like