Error Handling
Welcome to Chapter 5! You are doing great! In this chapter, we will discuss a new approach provided by functional programming to handle errors. We will do so through the help of the following sections:
- Traditional error handling in C#
- The Result type
- Railway-Oriented Programming (ROP)
- Designing your own error-handling mechanisms
- Practical tips for functional error handling
- Traditional versus functional error handling comparison
- Patterns and anti-patterns in functional error handling
Steve is really upset today because he spent the last three days fixing errors and didn’t have time to write even a single line of new code. Moreover, benchmark tests showed that the code with try-catch blocks works much slower than the one without them and that there are a lot of these blocks in his code. So he decided to ask Julia whether there was a way to handle errors better with a functional approach. She sent Steve a big article about error...