@@ -94,7 +94,7 @@ defmodule Phoenix.Sync.Router do
9494 more details on keyword-based shapes.
9595 """
9696 defmacro sync ( path , opts ) when is_list ( opts ) do
97- route ( env! ( __CALLER__ ) , path , build_definition ( path , __CALLER__ , opts ) )
97+ route ( env! ( __CALLER__ ) , path , build_definition ( __CALLER__ , opts ) )
9898 end
9999
100100 # e.g. shape "/path", Ecto.Query.from(t in MyTable)
@@ -140,13 +140,13 @@ defmodule Phoenix.Sync.Router do
140140 end
141141 end
142142
143- defp build_definition ( path , caller , opts ) when is_list ( opts ) do
143+ defp build_definition ( caller , opts ) when is_list ( opts ) do
144144 case Keyword . fetch ( opts , :query ) do
145145 { :ok , queryable } ->
146146 build_shape_from_query ( queryable , caller , opts )
147147
148148 :error ->
149- define_shape ( path , caller , opts )
149+ define_shape ( caller , opts )
150150 end
151151 end
152152
@@ -167,23 +167,21 @@ defmodule Phoenix.Sync.Router do
167167 end
168168 end
169169
170- defp define_shape ( path , caller , opts ) do
171- relation = build_relation ( path , opts )
170+ defp define_shape ( caller , opts ) do
171+ relation = build_relation ( opts )
172172
173173 { storage , _binding } = Code . eval_quoted ( opts [ :storage ] , [ ] , caller )
174174
175175 Phoenix.Sync.PredefinedShape . new! ( Keyword . merge ( opts , relation ) , storage: storage )
176176 end
177177
178- defp build_relation ( path , opts ) do
178+ defp build_relation ( opts ) do
179179 case Keyword . fetch ( opts , :table ) do
180180 { :ok , table } ->
181181 [ table: table ]
182182
183183 :error ->
184- raise ArgumentError ,
185- message:
186- "No valid table specified. The path #{ inspect ( path ) } is not a valid table name and no `:table` option passed."
184+ raise ArgumentError , message: "Cannot build shape: no :table specified."
187185 end
188186 |> add_namespace ( opts )
189187 end
0 commit comments