mirror of
https://github.com/ash-project/ash.git
synced 2024-09-19 13:03:02 +12:00
Replace PaginationNotSupported exception with ActionRequiresPagination exception (#1411)
This commit is contained in:
parent
c7b861c511
commit
e2731ecd2d
3 changed files with 2 additions and 15 deletions
|
@ -1,13 +0,0 @@
|
|||
defmodule Ash.Error.Invalid.PaginationNotSupported do
|
||||
@moduledoc "Used when page option is passed but pagination is not enabled."
|
||||
use Ash.Error.Exception
|
||||
|
||||
use Splode.Error, fields: [:resource, :action], class: :invalid
|
||||
|
||||
def message(%{resource: resource, action: action}) do
|
||||
"""
|
||||
Pagination is not supported for #{inspect(resource)}.#{action}, but
|
||||
pagination parameters were supplied.
|
||||
"""
|
||||
end
|
||||
end
|
|
@ -288,7 +288,7 @@ defmodule Ash.Helpers do
|
|||
if page && page != [] && !Map.get(action, :pagination) do
|
||||
{:error,
|
||||
Ash.Error.to_error_class(
|
||||
Ash.Error.Invalid.PaginationNotSupported.exception(
|
||||
Ash.Error.Invalid.ActionRequiresPagination.exception(
|
||||
resource: query.resource,
|
||||
action: action
|
||||
)
|
||||
|
|
|
@ -325,7 +325,7 @@ defmodule Ash.Test.Actions.ReadTest do
|
|||
Ash.read!(Post, action: :not_paginatable, page: [limit: 10])
|
||||
end
|
||||
|
||||
assert %Ash.Error.Invalid.PaginationNotSupported{resource: Post, action: _} =
|
||||
assert %Ash.Error.Invalid.ActionRequiresPagination{resource: Post, action: _} =
|
||||
hd(res.errors)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue