I’m trying to make sense of something and the fact that I don’t understand it might prove that I’m using it wrong.
I’ve got various changeset functions exposed for an Ecto Schema. They add an optimistic lock check to the changeset structs.
As part of a large Ecto Multi, I noticed that when the update fails because of a lock mismatch, an exception is raised rather than an error tuple.
This kind of defeats the purpose of using an Ecto Multi in the first place, as the goal is to have the result of multi |> Repo.transaction()
piped into a case
statement, to gracefully let the user know what’s happening.
What is wrong in my logic?