Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prelude.map()/Prelude.map() Callback Function Swallowed All Exception #1447

Open
mannok opened this issue Mar 6, 2025 · 0 comments
Open

Comments

@mannok
Copy link

mannok commented Mar 6, 2025

Hello,

I'm currently using LanguageExt and have encountered a challenge regarding exception handling within the map and mapAsync callback functions. While using these functions to transform collections, I've found it difficult to propagate exceptions from inside the callback to the outside context.

Problem Description

When an exception occurs inside a callback function provided to map or mapAsync, it seems that the exception is not easily propagated to the outside world. This makes it challenging to handle errors effectively and perform any necessary cleanup or logging.

Example Scenario

Here's a simplified example of what I'm trying to achieve:

await mapAsync(Task.FromResult(true) , async predicate =>
                {
                        throw new Exception("THIS EXCEPTION GOT SWALLOWED");
                        return "test";
                });

May I know how should I handle exception inside map()/mapAsync()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant