abreujp

abreujp

Learning Elixir: Error Handling Basics

I’ve published a new article in my Elixir learning series on dev.to exploring error handling with tagged tuples - the {:ok, value} / {:error, reason} pattern that’s idiomatic to Elixir.

The article covers:

  • Understanding the tagged tuple convention and when to use it
  • Returning descriptive results from your functions
  • Handling errors at the call site with case and pattern matching
  • Chaining operations cleanly with with and the else clause
  • The bang convention (!) and its role in the ecosystem
  • Practical patterns: validation, form handling, and batch processing

With complete working examples you can copy into IEx, you’ll learn how to treat errors as values and write code that handles failure paths explicitly.
Check it out:

Where Next?

Popular in Blog Posts Top

biportal
Hi, I recently thought about a name for this Stack: Rust + Elixir + Phoenix. I came up with Runix (RuNix) and blogged about it on Medium....
New
jordiee
https://medium.com/@jpiepkow/distributed-state-is-hard-5a0d384c2f3c
New
ellispritchard
Somebody was asking about Erlang OS signal handling on Slack; I’ve posted up my learnings: https://medium.com/@ellispritchard/graceful-s...
New
lawik
We all have varying degrees of exposure to Big Tech. Some of it seems fine, stable and can be relied on. Some of it feels like shifting s...
New
RudManusachi
Hi there! Recently I was playing around with extracting and updating data in the DB and for fun challenged myself to try to implement a ...
New
rms.mrcs
https://medium.com/the-realreal-product-tech-blog/monitoring-hackney-connection-pools-with-telemetry-3aaeafa8eeb8 Hi, everyone! In this ...
New
rrrene
In this series, we take a look at the different ways to organize, structure and execute a good “flow” in our Elixir programs. The latest...
New
wmnnd
Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New
marcin
Hi! :waving_hand: I wanted to refresh my knowledge on how to mix phx.gen.auth with local password users db, as well as OAuth providers s...
New
AstonJ
Just finished doing a clean install of macOS (which I highly recommend btw!) and have updated my macOS Ruby & Elixir/Erlang dev env s...
New

Other popular topics Top

skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement