OkThen.Result.error_assert-exclamation-mark

You're seeing just the function error_assert-exclamation-mark, go back to OkThen.Result module for more information.
Link to this function

error_assert!(result, check_function \\ fn _ -> true end)

Specs

error_assert!(result_input(), (any() -> boolean())) :: result_input()

Raises ArgumentError if result is not tagged :error. Otherwise, returns result unchanged. You may optionally provide check_function/1, which will receive the unwrapped value and must return a boolean. If the return value is false the function will raise.

Examples

iex> {:ok, "hello"} |> Result.error_assert!(:ok)
{:ok, "hello"}

iex> {:ok, "hello"} |> Result.error_assert!(:ok, &String.length(&1) == 5)
{:ok, "hello"}

iex> {:ok, "hello"} |> Result.error_assert!(:ok, &String.length(&1) == 0)
** (ArgumentError) Result value failed assertion: {:ok, "hello"}.

iex> :some |> Result.error_assert!(:some)
:some

iex> :error |> Result.error_assert!(:ok)
** (ArgumentError) Result is not tagged ok: :error.

iex> {:ok, "hello"} |> Result.error_assert!(:error)
** (ArgumentError) Result is not tagged error: {:ok, "hello"}.

iex> :none |> Result.error_assert!(:ok)
** (ArgumentError) Result is not tagged ok: :none.

iex> "hello" |> Result.error_assert!(:untagged)
"hello"

iex> "hello" |> Result.error_assert!(:ok)
** (ArgumentError) Result is not tagged ok: "hello".