Skip to content
This repository was archived by the owner on Sep 1, 2021. It is now read-only.

Exceptions

Tolik Pylypchuk edited this page May 30, 2018 · 4 revisions

UnacceptableNullException

In the .NET base class library there are 2 main null exceptions: NullReferenceException and ArgumentNullException. The first one is designed to be thrown when there is an attempt to dereference an object, which is null. The second one is designed to be thrown when a method parameter, which must not be null, is in fact null.

So, I've decided to add a general "null is not welcome" exception. In CSX, it is used by higher-order functions, which use a result of the function provided to them and this result must not be null.

Examples of usage are available here.

OptionAbsentException

This exception is thrown when someone attempts to get the value of an empty option using the GetOrThrow method. It may contain a message passed to the GetOrThrow method.

The use of this exception is discouraged since there are better ways to handle the absence of an option, such as default values or matchers.

Examples of usage are available here.

ResultFailedException

More on that later.

Clone this wiki locally