Skip to content
Snippets Groups Projects
Commit b1bd5497 authored by Jens Nolte's avatar Jens Nolte
Browse files

Do not wrap exceptions from async when invoking exception handler


Co-authored-by: default avatarJan Beinke <git@janbeinke.com>
parent fd781fd6
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ async action = asyncWithUnmask \unmask -> unmask action
asyncWithUnmask :: MonadResourceManager m => ((ResourceManagerIO a -> ResourceManagerIO a) -> ResourceManagerIO r) -> m (Awaitable r)
asyncWithUnmask action = do
resourceManager <- askResourceManager
asyncWithHandlerAndUnmask (throwToResourceManager resourceManager) action
asyncWithHandlerAndUnmask (throwToResourceManager resourceManager . AsyncException) action
async_ :: MonadResourceManager m => (ResourceManagerIO ()) -> m ()
async_ action = void $ async action
......
......@@ -110,7 +110,9 @@ unmanagedAsyncWithHandlerAndUnmask handler action = do
catchAll
case result of
Left (fromException -> Just AsyncDisposed) -> pure ()
Left ex -> handler ex
Left (fromException -> Just (AsyncException ex)) -> handler ex
-- Impossible code path reached
Left ex -> traceIO $ "Error in unmanagedAsyncWithHandlerAndUnmask: " <> displayException ex
_ -> pure ()
\ex -> traceIO $ "An exception was thrown while handling an async exception: " <> displayException ex
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment