mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: properly intercept thrown errors in Ash.bulk_create
This commit is contained in:
parent
69b5bd3d3c
commit
ca7b0824d7
1 changed files with 3 additions and 3 deletions
|
@ -662,7 +662,7 @@ defmodule Ash.Actions.Create.Bulk do
|
|||
|
||||
defp errors(result, {:error, error}, opts) do
|
||||
if opts[:return_errors?] do
|
||||
{result.error_count + 1, [error | result.errors]}
|
||||
{result.error_count + 1, [error | result.errors || []]}
|
||||
else
|
||||
{result.error_count + 1, []}
|
||||
end
|
||||
|
@ -758,7 +758,7 @@ defmodule Ash.Actions.Create.Bulk do
|
|||
|
||||
defp store_error(ref, error, opts) do
|
||||
if opts[:stop_on_error?] && !opts[:return_stream?] do
|
||||
throw({:error, Ash.Error.to_error_class(error), 0, []})
|
||||
throw({:error, Ash.Error.to_error_class(error), 0})
|
||||
else
|
||||
if opts[:return_errors?] do
|
||||
{errors, count} = Process.get({:bulk_create_errors, ref}) || {[], 0}
|
||||
|
@ -1412,7 +1412,7 @@ defmodule Ash.Actions.Create.Bulk do
|
|||
changeset
|
||||
|
||||
{:error, error} ->
|
||||
Ash.Changeset.add_error(changeset, error)
|
||||
Ash.Changeset.add_error(changeset, validation.message || error)
|
||||
end
|
||||
|
||||
true ->
|
||||
|
|
Loading…
Reference in a new issue