Skip to content

Commit de37242

Browse files
authored
fix: handle errors from identities in polymorphic resources properly (#497)
1 parent 20a8631 commit de37242

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/data_layer.ex

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1964,7 +1964,17 @@ defmodule AshPostgres.DataLayer do
19641964
end
19651965
rescue
19661966
e ->
1967-
changeset = Ash.Changeset.new(resource)
1967+
changeset =
1968+
case source do
1969+
{table, resource} ->
1970+
resource
1971+
|> Ash.Changeset.new()
1972+
|> Ash.Changeset.put_context(:data_layer, %{table: table})
1973+
1974+
resource ->
1975+
resource
1976+
|> Ash.Changeset.new()
1977+
end
19681978

19691979
handle_raised_error(
19701980
e,

0 commit comments

Comments
 (0)