Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions lib/error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -184,26 +184,30 @@ defimpl AshGraphql.Error, for: Ash.Error.Invalid.InvalidPrimaryKey do
end
end

defimpl AshGraphql.Error, for: AshAuthentication.Errors.AuthenticationFailed do
def to_error(_error) do
%{
message: "Authentication failed",
short_message: "Authentication failed",
fields: [],
code: "authentication_failed",
vars: %{}
}
end
end

defimpl AshGraphql.Error, for: AshAuthentication.Errors.InvalidToken do
def to_error(_error) do
%{
message: "An invalid token was presented",
short_message: "Invalid token",
fields: [],
code: "invalid_token",
vars: %{}
}
if Code.ensure_loaded?(AshAuthentication.Errors.AuthenticationFailed) do
defimpl AshGraphql.Error, for: AshAuthentication.Errors.AuthenticationFailed do
def to_error(_error) do
%{
message: "Authentication failed",
short_message: "Authentication failed",
fields: [],
code: "authentication_failed",
vars: %{}
}
end
end
end

if Code.ensure_loaded?(AshAuthentication.Errors.InvalidToken) do
defimpl AshGraphql.Error, for: AshAuthentication.Errors.InvalidToken do
def to_error(_error) do
%{
message: "An invalid token was presented",
short_message: "Invalid token",
fields: [],
code: "invalid_token",
vars: %{}
}
end
end
end
Loading