mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-19 12:52:55 +12:00
fix: add back in accidentally removed debug errors code
this also cleans up references to `Ash.ErrorKind` which is dead code in 3.x
This commit is contained in:
parent
151240df32
commit
319fd4faef
3 changed files with 10 additions and 29 deletions
|
@ -2,8 +2,6 @@ defmodule AshAuthentication.Errors.AuthenticationFailed do
|
|||
@moduledoc """
|
||||
A generic, authentication failed error.
|
||||
"""
|
||||
use Ash.Error.Exception
|
||||
|
||||
use Splode.Error,
|
||||
fields: [
|
||||
caused_by: %{},
|
||||
|
@ -14,14 +12,17 @@ defmodule AshAuthentication.Errors.AuthenticationFailed do
|
|||
],
|
||||
class: :forbidden
|
||||
|
||||
alias AshAuthentication.Debug
|
||||
|
||||
@type t :: Exception.t()
|
||||
|
||||
def message(_), do: "Authentication failed"
|
||||
|
||||
defimpl Ash.ErrorKind do
|
||||
@moduledoc false
|
||||
def id(_), do: Ecto.UUID.generate()
|
||||
def code(_), do: "authentication_failed"
|
||||
def message(_), do: "Authentication failed"
|
||||
@impl true
|
||||
def exception(args) do
|
||||
args
|
||||
|> super()
|
||||
|> Debug.describe()
|
||||
end
|
||||
|
||||
@impl true
|
||||
def message(_), do: "Authentication failed"
|
||||
end
|
||||
|
|
|
@ -2,16 +2,7 @@ defmodule AshAuthentication.Errors.InvalidToken do
|
|||
@moduledoc """
|
||||
An invalid token was presented.
|
||||
"""
|
||||
use Ash.Error.Exception
|
||||
use Splode.Error, fields: [:type], class: :forbidden
|
||||
|
||||
def message(%{type: type}), do: "Invalid #{type} token"
|
||||
|
||||
defimpl Ash.ErrorKind do
|
||||
@moduledoc false
|
||||
def id(_), do: Ecto.UUID.generate()
|
||||
def code(_), do: "invalid_token"
|
||||
def message(%{type: nil}), do: "Invalid token"
|
||||
def message(%{type: type}), do: "Invalid #{type} token"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,20 +2,9 @@ defmodule AshAuthentication.Errors.MissingSecret do
|
|||
@moduledoc """
|
||||
A secret is now missing.
|
||||
"""
|
||||
use Ash.Error.Exception
|
||||
use Splode.Error, fields: [:resource], class: :forbidden
|
||||
|
||||
def message(%{path: path, resource: resource}) do
|
||||
"Secret for `#{Enum.join(path, ".")}` on the `#{inspect(resource)}` resource is not accessible."
|
||||
end
|
||||
|
||||
defimpl Ash.ErrorKind do
|
||||
@moduledoc false
|
||||
def id(_), do: Ecto.UUID.generate()
|
||||
def code(_), do: "missing_secret"
|
||||
|
||||
def message(%{path: path, resource: resource}),
|
||||
do:
|
||||
"Secret for `#{Enum.join(path, ".")}` on the `#{inspect(resource)}` resource is not accessible."
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue