diff --git a/lib/latch/error/store.ex b/lib/latch/error/store.ex index 919e0db..6805296 100644 --- a/lib/latch/error/store.ex +++ b/lib/latch/error/store.ex @@ -14,6 +14,8 @@ defmodule Latch.Error.Store do * `:delete_expired_requests` """ + alias Latch.Store, as: StoreBehavior + defexception [:action, :did, :reason] @type action :: @@ -25,7 +27,11 @@ defmodule Latch.Error.Store do | :put_request | :delete_expired_requests - @type t :: %__MODULE__{action: action(), did: String.t() | nil, reason: term() | nil} + @type t :: %__MODULE__{ + action: action(), + did: String.t() | nil, + reason: StoreBehavior.reason() + } @impl Exception def message(%__MODULE__{action: action, did: did, reason: reason}) do diff --git a/lib/latch/store.ex b/lib/latch/store.ex index 3ff3503..f6b2869 100644 --- a/lib/latch/store.ex +++ b/lib/latch/store.ex @@ -16,8 +16,9 @@ defmodule Latch.Store do @type state :: binary() @type did :: binary() - # TODO fix the term here, it should be specific atoms not "something" - @type store_error :: {:error, :not_found} | {:error, term()} + + @type reason :: :not_found | :backend_error + @type store_error :: {:error, reason()} @doc """ Store an inflight request under `state` for at least `ttl_seconds`.