mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: properly wrap errored changesets in {:error
in bulk creates
This commit is contained in:
parent
03e85a054a
commit
d56937aeb6
1 changed files with 6 additions and 2 deletions
|
@ -345,7 +345,7 @@ defmodule Ash.Actions.Create.Bulk do
|
||||||
|
|
||||||
{:error, notifications, error} ->
|
{:error, notifications, error} ->
|
||||||
if opts[:stop_on_error?] do
|
if opts[:stop_on_error?] do
|
||||||
{:halt, {[], error}}
|
{:halt, {notify_stream([], notifications, resource, action, opts), error}}
|
||||||
else
|
else
|
||||||
{error
|
{error
|
||||||
|> List.wrap()
|
|> List.wrap()
|
||||||
|
@ -355,7 +355,11 @@ defmodule Ash.Actions.Create.Bulk do
|
||||||
|
|
||||||
{:ok, invalid, notifications} ->
|
{:ok, invalid, notifications} ->
|
||||||
if opts[:stop_on_error?] && !Enum.empty?(invalid) do
|
if opts[:stop_on_error?] && !Enum.empty?(invalid) do
|
||||||
{:halt, {[], invalid}}
|
{:halt,
|
||||||
|
{[],
|
||||||
|
invalid
|
||||||
|
|> Stream.map(&{:error, &1})
|
||||||
|
|> notify_stream(notifications, resource, action, opts)}}
|
||||||
else
|
else
|
||||||
{invalid
|
{invalid
|
||||||
|> Stream.map(&{:error, &1})
|
|> Stream.map(&{:error, &1})
|
||||||
|
|
Loading…
Reference in a new issue