CSharpFunctionalExtensions icon indicating copy to clipboard operation
CSharpFunctionalExtensions copied to clipboard

Question about exception handling

Open chitoiur opened this issue 2 years ago • 2 comments
trafficstars

I had a call to Map in my chain, but the callback was throwing an exception. I was expecting for the exception to be caught internally and for the result to be errored out to the exception message, but that didn't happen and it just threw the exception into my code. That's understandable, but my question is what is the recommended way to handle exceptions inside callbacks/lambdas so that the error gets set properly into the result?

chitoiur avatar May 20 '23 00:05 chitoiur

Never mind, I found that there is BindTry. I initially did not find it, because it's not in the docs. But I did find it in the source code. Perhaps it should be mentioned in the docs.

chitoiur avatar May 22 '23 12:05 chitoiur

Yeah, the docs are lacking, that's true.

vkhorikov avatar May 22 '23 21:05 vkhorikov