Skip to content

Conversation

@torgeirsh
Copy link
Contributor

I copied and edited the code from unliftio. Since other functions from Effectful.Exception are used, the withRunInIO in the original code isn't needed, but I don't know if it would be better to use reallyUnsafeUnliftIO and call the Control.Exception functions directly. I'm not an expert on exceptions, so I don't know if it affects the safety.

For reference, safe-exceptions has a slightly different implementation that uses generalBracket.

@arybczak
Copy link
Member

Superseded by #311.

@arybczak arybczak closed this Mar 13, 2025
@torgeirsh
Copy link
Contributor Author

Thanks! I noticed that the replacement doesn't use masking. Isn't there a risk of losing the original exception if a new asynchronous exception occurs between the catch and the rethrow?

@arybczak
Copy link
Member

the replacement doesn't use masking

It does, catch masks the exception handler. It uses mask rather than uninterruptibleMask, but that's a tradeoff that's discussed here if you're interested in details.

Effectful.Exception is supposed to be a thin wrapper for Control.Exception so it doesn't use uninterruptibleMask, but if someone really wants the behavior of safe-exceptions, the library works just fine with effectful ;)

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

Successfully merging this pull request may close these issues.

2 participants