⚠ Deprecated: Legacy
Package Description
$ dotnet add package ErrorOr.ExtensionsAn extension library for ErrorOr by Amichai Mantinband.
This library extends the ErrorOr library with useful features to allow for some specific workflows, for creating meaningful error handling in your applications.
This library provides LINQ extensions for ErrorOr. This enables a very clean approach of binding multiple ErrorOr
generating function together. You can write them with the usual from x in y select x syntax you know and love from
LINQ. If an error occurs along the way, processing of the chain is interrupted and the collected errors are passed to
the resulting instance of ErrorOr<T>.
Example:
ErrorOr<string> errorOr =
from userId in ParseInput("10") // returns ErrorOr<int>
from user in userRepository.Lookup(userId) // returns ErrorOr<User>
select user.Name // maps to string
This also works if the methods that are chained are asynchronous:
Task<ErrorOr<string>> errorOr =
from userId in ParseInput("10") // returns Task<ErrorOr<int>>
from user in userRepository.Lookup(userId) // returns Task<ErrorOr<User>>
select user.Name // maps to string
The author of this extension library is not affiliated with Amichai Mantinband nor does he claim anything from the ErrorOr library.