Skip to content

Commit

Permalink
refactor: Return :not_found if the record was not found
Browse files Browse the repository at this point in the history
  • Loading branch information
olafbado authored and vincentvanbush committed Apr 10, 2024
1 parent f02b2e1 commit 9ab5c83
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/permit_ecto/resolver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defmodule Permit.Ecto.Resolver do
import Permit.Helpers, only: [resource_module_from_resource: 1]

@impl Permit.ResolverBase

def resolve(subject, authorization_module, resource_module, action, %{} = meta, :one) do
%{base_query: base_query} = meta = ensure_meta_defaults(meta)

Expand All @@ -43,7 +44,7 @@ defmodule Permit.Ecto.Resolver do
meta
) do
{true, _} -> :unauthorized
{false, query} -> raise Ecto.NoResultsError, queryable: query
{false, _query} -> :not_found
end
end
end
Expand Down

0 comments on commit 9ab5c83

Please sign in to comment.