simplify user resolver errors

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2020-11-30 10:24:31 +01:00
parent 2d541f2e32
commit b05f0fe3e6
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -39,7 +39,7 @@ defmodule Mobilizon.GraphQL.Resolvers.User do
end end
def get_current_user(_parent, _args, _resolution) do def get_current_user(_parent, _args, _resolution) do
{:error, "You need to be logged-in to view current user"} {:error, :unauthenticated}
end end
@doc """ @doc """
@ -55,7 +55,7 @@ defmodule Mobilizon.GraphQL.Resolvers.User do
end end
def list_users(_parent, _args, _resolution) do def list_users(_parent, _args, _resolution) do
{:error, dgettext("errors", "You need to have admin access to list users")} {:error, :unauthorized}
end end
@doc """ @doc """
@ -73,7 +73,7 @@ defmodule Mobilizon.GraphQL.Resolvers.User do
{:ok, user_and_tokens} {:ok, user_and_tokens}
else else
{:error, :user_not_found} -> {:error, :user_not_found} ->
{:error, dgettext("errors", "No user with this email was found")} {:error, :user_not_found}
{:error, :disabled_user} -> {:error, :disabled_user} ->
{:error, dgettext("errors", "This user has been disabled")} {:error, dgettext("errors", "This user has been disabled")}