5

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 ...

Get Functional Programming with C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.