-
Notifications
You must be signed in to change notification settings - Fork 0
Exceptions
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.
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.
More on that later.