@@ -2,20 +2,8 @@ defmodule Ecto.Repo.Transaction do
22 @ moduledoc false
33 @ dialyzer :no_opaque
44
5- def transact ( repo , _name , fun , { adapter_meta , opts } ) when is_function ( fun , 0 ) do
6- adapter_meta . adapter . transaction ( adapter_meta , opts , fn ->
7- case fun . ( ) do
8- { :ok , result } ->
9- result
10-
11- { :error , reason } ->
12- rollback ( repo , reason )
13-
14- other ->
15- raise ArgumentError ,
16- "expected to return {:ok, _} or {:error, _}, got: #{ inspect ( other ) } "
17- end
18- end )
5+ def transact ( repo , name , fun , adapter_opts ) when is_function ( fun , 0 ) do
6+ transact ( repo , name , fn _repo -> fun . ( ) end , adapter_opts )
197 end
208
219 def transact ( repo , _name , fun , { adapter_meta , opts } ) when is_function ( fun , 1 ) do
@@ -25,7 +13,7 @@ defmodule Ecto.Repo.Transaction do
2513 result
2614
2715 { :error , reason } ->
28- rollback ( repo , reason )
16+ adapter_meta . adapter . rollback ( adapter_meta , reason )
2917
3018 other ->
3119 raise ArgumentError ,
@@ -48,7 +36,7 @@ defmodule Ecto.Repo.Transaction do
4836
4937 { :error , operation } ->
5038 raise """
51- operation #{ inspect operation } is rolling back unexpectedly.
39+ operation #{ inspect ( operation ) } is rolling back unexpectedly.
5240
5341 This can happen if `repo.rollback/1` is manually called, which is not \
5442 supported by `Ecto.Multi`. It can also occur if a nested transaction \
0 commit comments