OkThen.Result.tagged_unwrap-exclamation-mark
You're seeing just the function
tagged_unwrap-exclamation-mark
, go back to OkThen.Result module for more information.
Link to this function
tagged_unwrap!(result, tag)
Specs
tagged_unwrap!(result_input(), atom()) :: any()
Same as tagged_unwrap_or_else/3
, except raises ArgumentError
if result
is not tagged with
the specified tag
atom.
Examples
iex> {:ok, "hello"} |> Result.tagged_unwrap!(:ok)
"hello"
iex> :some |> Result.tagged_unwrap!(:some)
{}
iex> :error |> Result.tagged_unwrap!(:ok)
** (ArgumentError) Value is not tagged ok: :error.
iex> {:ok, "hello"} |> Result.tagged_unwrap!(:error)
** (ArgumentError) Value is not tagged error: {:ok, "hello"}.
iex> :none |> Result.tagged_unwrap!(:ok)
** (ArgumentError) Value is not tagged ok: :none.
iex> "hello" |> Result.tagged_unwrap!(:untagged)
"hello"
iex> "hello" |> Result.tagged_unwrap!(:ok)
** (ArgumentError) Value is not tagged ok: {:untagged, "hello"}.