You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever creating an Ecto.Multi that returns an error.
(Such as by using Ecto.Multi.error or by returning {:error, val} rather than {:ok, val} from an Ecto.Multi.run), this is not properly passed up through the Repo.transaction call.
Furthermore, rather than passing a value up, a CaseClauseError is raised.
** (CaseClauseError) no case clause matching: {:error, :rollback}
(ecto) lib/ecto/repo/queryable.ex:21: Ecto.Repo.Queryable.transaction/4
The text was updated successfully, but these errors were encountered:
Qqwy
changed the title
Ecto.Multi errors result in {:error, :rollback} rather than the error that was raised in the Ecto.Multi function.
Ecto.Multi errors result in CaseClauseError {:error, :rollback} rather than the error that was raised in the Ecto.Multi function.
Jan 14, 2019
This is on the newest Ecto that EctoMnesia supports, which is 2.1 IIRC.
I was able to find the cause of this problem, btw. It's here. The rollback function is expected to take the reason as second argument, but EctoMnesia uses an unused _tid argument and hard-codes Mnesia.abort with the reason :rollback.
This causes Ecto.Multi's transaction handling logic (see here to crash because it expects the error result contain a four-element tuple rather than :rollback.
Whenever creating an Ecto.Multi that returns an error.
(Such as by using
Ecto.Multi.error
or by returning{:error, val}
rather than{:ok, val}
from anEcto.Multi.run
), this is not properly passed up through theRepo.transaction
call.Furthermore, rather than passing a value up, a
CaseClauseError
is raised.Example:
Expected result:
Actual result:
The text was updated successfully, but these errors were encountered: