OkThen.Result.error_unwrap_or_else

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

error_unwrap_or_else(result, func_or_value)

Specs

error_unwrap_or_else(result_input(), func_or_value(any())) :: any()

Returns the wrapped value if result is tagged :error. Otherwise, passes the tag and wrapped value into the provided function and returns the result. If the function has arity 1, then only the wrapped value is passed in. An arity-0 function is also accepted. If func_or_value is not a function, then it is used directly as the new value.

See also tagged_or_else/3.

Equivalent to tagged_unwrap_or_else(result, :error, default). See tagged_unwrap_or_else/3.

Examples

iex> {:error, "hello"} |> Result.error_unwrap_or_else("default")
"hello"

iex> :error |> Result.error_unwrap_or_else("default")
{}

iex> :ok |> Result.error_unwrap_or_else("default")
"default"

iex> {:ok, "hello"} |> Result.error_unwrap_or_else("default")
"default"

iex> {:ok, "hello"}
...> |> Result.error_unwrap_or_else(fn
...>   :ok, "hello" -> "default"
...> end)
"default"

iex> {:ok, "hello"}
...> |> Result.error_unwrap_or_else(fn
...>   "hello" -> "default"
...> end)
"default"

iex> {:error, "hello"} |> Result.tagged_unwrap_or_else(:ok, fn -> "default" end)
"default"

iex> :none |> Result.error_unwrap_or_else("default")
"default"

iex> "hello" |> Result.error_unwrap_or_else("default")
"default"