2 ms·
What happens with this code when err isn't recoverable? you can manage it a few ways in Elixir, struct matching is one: def perform(param) do res =
by arthurbrown 7y ago
What happens with this code when err isn't recoverable?
you can manage it a few ways in Elixir, struct matching is one:
def perform(param) do
res =
case get_resource(param) do
{:ok, val} -> val
{:error, %RecoverableError{alternative_value: val}} -> val
end
do_more_things(res)
end