abreujp
Learning Elixir: Error Handling with try/rescue/catch/after
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:
Popular in Blog Posts
https://medium.com/blackode
This article comprises of two biggest changes of ExUnit.
Arguments in the failure report
Running mix tes...
New
https://readyforproduction.dev/blog/view-transitions-api-and-phoenix-liveview
New
Somebody was asking about Erlang OS signal handling on Slack; I’ve posted up my learnings:
https://medium.com/@ellispritchard/graceful-s...
New
Learn how to leverage Erlang + Elixir’s GenServer to build a robust FTP Client.
https://rlopzc.com/posts/elixir-ftp-client-genserver-par...
New
Livebook was created for machine learning in Elixir but Livebook isn’t limited to machine learning. I found it works really well for docu...
New
How to set up the Content Security Policy header with Phoenix LiveView and support inline styles and scripts with CSP nonces.
New
I describe how we use Hot Reloading with Webpack to develop faster and show how to integrate Webpack 5, webpack-dev-server, and Phoenix f...
New
I had a bit of a mini-adventure following Sobelow’s advice on adding a CSP to a Phoenix App. If you want to follow along, or want to add ...
New
Elixir Blog Post: Live video streaming from iOS devices made simple with Elixir & Membrane Framework
Greetings from Membrane Framework team!
Check out our case study based on our latest projects at Software Mansion.
https://blog.swmansi...
New
Building on other people’s work I bashed things together and suddenly I can know when someone is speaking using Elixir and Membrane.
New
Other popular topics
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Hi,
I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
Hi everyone,
I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









