Replace PaginationNotSupported exception with ActionRequiresPagination exception (#1411)

This commit is contained in:
Jinkyou Son 2024-08-31 02:11:46 +09:00 committed by GitHub
parent c7b861c511
commit e2731ecd2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 15 deletions

View file

@ -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

View file

@ -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
)

View file

@ -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