Digests » 262
this week's favorite
Thinking in processes is already difficult; writing automated tests for those processes shouldn’t make it worse. Elixir provides the necessary tooling to ensure your processes are rock solid. This article explains how to use them.
Error handling (aka exception handling) in Elixir often manifests itself with the try and rescue keywords, which correspond to errors that are triggered using raise/1 and raise/2.
LiveViews suffer from the same neck snapping, eye darting issues as GenServers. With a GenServer you define a client API, then a server API. Check the client API for the arguments passed in. Did we pattern match on the client side? Look for handle_* to see what it does, and how it handles errors. Also, testing complex logic in GenServers is less than great. But that’s fine! We have a way to deal with this by decoupling our Boundary Layer from our core business logic, breaking them into nice, pure functions we can easily test.
Take a deep dive into the Actor Model and learn how GenServers can be leveraged in unison with your database.