C#C
C#2y ago
LazyGuard

✅ Functional programming instead of exceptions

I've watched this video where Derek implements an Either from scratch to make method signatures more explicit rather than throwing an exception. He also adds a Map method to force the client code to deal with both cases

However, the problem is that not every method has one successful path and one failure path. For example, the PostAsync. has many possible ways to fail (see exceptions here https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.postasync?view=net-8.0 ). So how to deal with this kind of situations ? especially if we want to keep the granularity of all the different ways to fail and we want to handle different failures in different ways in the client code
Send a POST request to the specified Uri as an asynchronous operation.
Was this page helpful?