Open saep opened 2 years ago
I experienced this issue when calling vim from an async
thread! Maybe I am confused that it never used to report exceptions in async threads?
I can put together an mvp later today
The following code swallows exceptions and if the second to last line is not commented, and exception is visible.
neovimAsync :: (MonadUnliftIO m) => m a -> m (Async a)
neovimAsync m =
withRunInIO $ \lower ->
liftIO $ async $ lower m
throwExceptionFunctionAsync :: Neovim env Bool
throwExceptionFunctionAsync = do
spawned <- neovimAsync $ throwExceptionFunction
-- liftIO $ waitAnyCancel [spawned]
pure True
I barely ever program in Haskell, but to me it seems that this is kind of expected behavior from the async library?
Yeah, might be. Perhaps it's worth adding an async helper to the library that deals with this --- rather than doing the whole withRunInIO
dance. Would you be interested in a PR?
Sure!
Or maybe just use: https://hackage.haskell.org/package/unliftio-0.2.20.1/docs/UnliftIO-Async.html It's already a dependency and used internally.
@isovector wrote in #95 :
Is this actually true? I've written and incredibly useful plugin below and I receive log messages and I see error messages in neovim.
When calling the command
:ThrowExceptionCommand
:When calling the function with
:call ThrowExceptionFunction()
:When an autocmd is executed: