error-handling
Installation
SKILL.md
Elixir Error Handling Patterns
Tagged Tuples
The idiomatic way to handle success and failure in Elixir.
def fetch_user(id) do
case Repo.get(User, id) do
nil -> {:error, :not_found}
user -> {:ok, user}
end
end