typed fail excepion
Is it possible to create an additional overload for typed failed exceptions? As far as I can see, only an error-message is supported. But the type of exception is for example easy for unit-testing :)
cheers!
Hey there!
I would recommend segregating non-recoverable failures that should be represented with exceptions from excepted failures that are best expressed with Result. Here I wrote more on this: http://enterprisecraftsmanship.com/2017/03/13/error-handling-exception-or-result/
Regards, V.
One great feature of this library is extensibility/modularity/composibility, because it is mostly based on extension methods. I was able to easily experiment with a few iterations of typed extensions internally with some success, but I wasn't confident enough to propose/contribute them. I later went on to read about some more "experienced" strategies typed exception handling in C# (in the language-ext library, and a related functional C# book). I would do it differently now, and follow one of the pre-existing conventions.
I think that it's hard to use this library without eventually running up against situations where you want to go to the "next step" beyond Result<T>. So, eventually I hope I (or someone else) will find time to write a good implementation and propose it. Again, because of how this library is written, extensions can be separate Nuget packages and there would be little downside.
On the other hand, I completely understand the strategy to limit the scope, and refrain from going to this "next step" with the core library by @vkhorikov . It feels very concise the way it is now.
I believe this use-case is now covered by the Result<T, E> so I believe this could be closed.