Skip to content

Refactor catch error functions #15

@ondrej-tucek

Description

@ondrej-tucek

Examples of use:

iex> e = {:error, :bad}
iex> Result.catch_error(e, fn :bad -> {:ok, 123} end)
{:ok, 123}
iex> Result.catch_error(e, fn :wrong -> {:ok, 345} end)
{:error, :bad}
iex> Result.catch_error({:ok, 987}, fn :bad -> {:ok, 123} end)
{:ok, 987}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions