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