mirror of
https://github.com/ash-project/ash.git
synced 2024-09-19 13:03:02 +12:00
improvement: better error messages on incorrect action types
This commit is contained in:
parent
b999fb10ab
commit
d6a973cef0
2 changed files with 14 additions and 2 deletions
|
@ -1251,6 +1251,19 @@ defmodule Ash.Changeset do
|
|||
other -> other
|
||||
end
|
||||
|
||||
case action do
|
||||
%Ash.Resource.Actions.Update{name: name} ->
|
||||
raise ArgumentError,
|
||||
message: """
|
||||
Action #{inspect(changeset.resource)}.#{name} was passed to `Ash.Changeset.for_create`, but it is an update action.
|
||||
|
||||
Perhaps you meant to call `Ash.Changeset.for_create` instead?
|
||||
"""
|
||||
|
||||
_ ->
|
||||
:ok
|
||||
end
|
||||
|
||||
changeset
|
||||
|> set_context(%{
|
||||
private: %{
|
||||
|
|
|
@ -709,7 +709,6 @@ defmodule Ash.Test.Actions.LoadTest do
|
|||
|> Ash.Query.load([:posts, :latest_post])
|
||||
|> Ash.read!(authorize?: true)
|
||||
|
||||
author =
|
||||
Ash.load!(author, [:posts, :latest_post], lazy?: true)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue