Presented by: Brian Underwood and Adilet Abylov
About this talk
In this webinar, Brian Underwood and Adilet Abylov discuss Elixir’s with clause, a feature that can help simplify control flow. Although many developers have encountered with, it’s often not fully understood or used to its full potential.
Brian and Adilet discuss:
- How
withis often perceived as expressing the “happy path”, but how it’s a bit more complex than that - How
elsecan be used for specific error handling - Some of the common mistakes that can occur when patterns don’t match as expected.
- Practical techniques for managing errors, such as using helper functions
- The approach of adding context with tagged tuples
- Deciding when to handle or propagate errors in different layers of an application
- Single-clause
withstatements for handling errors or performing side effects like logging
What you’ll learn:
- How the with clause sometimes simplifies and sometimes complicates control flow in Elixir
- How the
elseclause changes the behaviour ofwith - Approaches for clean and maintainable error handling
- When single-clause
withstatements are useful