Skip to content

Commit 0de4734

Browse files
artiomvonagam
andauthored
Update lib/ash_phoenix/form_data/error.ex
Co-authored-by: Dmitry Maganov <vonagam@gmail.com>
1 parent 8522a53 commit 0de4734

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/ash_phoenix/form_data/error.ex

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@ end
1414

1515
defimpl AshPhoenix.FormData.Error, for: Ash.Error.Query.InvalidQuery do
1616
def to_form_error(error) do
17-
error_fields =
18-
if is_nil(error.field) do
19-
Map.get(error, :fields, [])
20-
else
21-
[error.field]
22-
end
17+
fields = List.wrap(error.field || Map.get(error, :fields) || [])
2318

24-
for field <- error_fields || [] do
19+
for field <- fields do
2520
{field, error.message, error.vars}
2621
end
2722
end

0 commit comments

Comments
 (0)