I’ve published a new article in my Elixir learning series on dev.to exploring what happens when tagged tuples aren’t enough - the try, rescue, catch, and after constructs for truly unexpected failures.
The article covers:
- When to use
try/rescuevs the{:ok, value}/{:error, reason}pattern - Understanding Elixir’s built-in exception types
- Rescuing exceptions with multiple clauses and inspecting
__STACKTRACE__ - Defining custom exceptions with
defexception - Using
catchfor throws and exits - including whycatchdoes NOT trap exit signals from other processes (I learned this the hard way) - The
afterclause for guaranteed cleanup - Practical guidelines for combining both error handling approaches
With complete working examples you can copy into IEx, you’ll learn when exceptions are the right tool - and when the “let it crash” philosophy serves you better.
Check it out:






















