Tag Exceptions

CQRS and exception handling

In this article, I’d like to discuss one particular aspect of exception handling relevant to CQRS and the decorator pattern.

What is an exceptional situation in code?

This is a continuation of the topic of error handling. We’ll discuss what an exceptional situation in code actually is and see some examples of it.

Error handling: Exception or Result?

In this post, we’ll look at some practical examples of error handling. We will see whether it is better to use exceptions or the Result class to deal with errors.

Custom exception types

Today’s topic is about custom exception types. That is whether or not you should write your own exception types to throw in different situations.

Functional C#: Handling failures, input errors

The topic described in this article is a part of my Applying Functional Principles in C# Pluralsight course. In this article, I’m going to write about how to deal with failures and invalid input in a functional way. Functional C#: Immutability Functional C#: Primitive obsession Functional C#: Non-nullable reference types Functional C#: Handling failures and input errors Handling errors in C#: the common approach The concept of validation and error processing is well known, but the code required to handle it may become really annoying in languages like C#.

Exceptions for flow control in C#

The use of exceptions for flow control was raised quite a few times already (here’s a c2 discussion and here is a great question on SO). I’d like to summarize this topic and provide some common use cases along with code examples to handle them. Exceptions for flow control: why not? Generally, code is read more often than written. Most of the best practices aim to simplify understanding and reasoning about the code: the simpler code, the fewer bugs it contains, and the easier it becomes to maintain the software.