annotated-exception 0.2.0.0 → 0.2.0.1
raw patch · 4 files changed
+51/−2 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−0
- annotated-exception.cabal +2/−1
- src/Control/Exception/Annotated/UnliftIO.hs +1/−1
- test/Control/Exception/Annotated/UnliftIOSpec.hs +43/−0
ChangeLog.md view
@@ -2,6 +2,11 @@ ## Unreleased changes +## 0.2.0.1++- [#13](https://github.com/parsonsmatt/annotated-exception/pull/13)+ - Fixed a bug in `UnliftIO.catches` where it would infinitely recurse.+ ## 0.2.0.0 - [#12](https://github.com/parsonsmatt/annotated-exception/pull/12)
annotated-exception.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: annotated-exception-version: 0.2.0.0+version: 0.2.0.1 synopsis: Exceptions, with checkpoints and context. description: Please see the README on Github at <https://github.com/parsonsmatt/annotated-exception#readme> category: Control@@ -47,6 +47,7 @@ type: exitcode-stdio-1.0 main-is: Spec.hs other-modules:+ Control.Exception.Annotated.UnliftIOSpec Control.Exception.AnnotatedSpec Data.AnnotationSpec Paths_annotated_exception
src/Control/Exception/Annotated/UnliftIO.hs view
@@ -146,4 +146,4 @@ catches action handlers = withRunInIO $ \runInIO -> do let f (Handler k) = Handler (\e -> runInIO (k e))- liftIO $ catches (runInIO action) (map f handlers)+ liftIO $ Catch.catches (runInIO action) (map f handlers)
+ test/Control/Exception/Annotated/UnliftIOSpec.hs view
@@ -0,0 +1,43 @@+module Control.Exception.Annotated.UnliftIOSpec where++import Test.Hspec++import Control.Exception.Annotated.UnliftIO+import qualified Control.Exception.Safe as Safe+import Data.Annotation+import GHC.Stack++import Data.AnnotationSpec ()+import Control.Exception.AnnotatedSpec (TestException(..))+import Data.Maybe++asIO :: IO a -> IO a+asIO = id++spec :: Spec+spec = do+ describe "catch" $ do+ describe "the right exception" $ do+ it "works" $ asIO $ do+ throw TestException+ `catch` \(AnnotatedException _ TestException) ->+ pure ()++ describe "the wrong exception" $ do+ it "works" $ asIO $ do+ let+ action =+ throw (userError "oh no")+ `catch` \(AnnotatedException _ TestException) ->+ expectationFailure "Should not catch"+ action `shouldThrow` \(AnnotatedException _ e) ->+ e == userError "oh no"++ describe "catches" $ do+ describe "the right exception" $ do+ it "works" $ asIO $ do+ throw TestException+ `catches`+ [ Handler $ \TestException ->+ pure ()+ ]