packages feed

annotated-exception 0.2.0.3 → 0.2.0.4

raw patch · 4 files changed

+43/−18 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for `annotated-exception` +## 0.2.0.4++- [#18](https://github.com/parsonsmatt/annotated-exception/pull/18)+    - Add `checkpointCallStack` even when `catch` doesn't catch an+      `AnnotatedException`+ ## 0.2.0.3  - [#17](https://github.com/parsonsmatt/annotated-exception/pull/17)
annotated-exception.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           annotated-exception-version:        0.2.0.3+version:        0.2.0.4 synopsis:       Exceptions, with checkpoints and context. description:    Please see the README on Github at <https://github.com/parsonsmatt/annotated-exception#readme> category:       Control
src/Control/Exception/Annotated.hs view
@@ -202,7 +202,8 @@ mkAnnotatedHandlers :: (HasCallStack, MonadCatch m) => [Handler m a] -> [Handler m a] mkAnnotatedHandlers xs =     xs >>= \(Handler hndlr) ->-        [ Handler hndlr+        [ Handler $ \e ->+            checkpointCallStack $ hndlr e         , Handler $ \(AnnotatedException anns e) ->             checkpointMany anns $ hndlr e         ]
test/Control/Exception/AnnotatedSpec.hs view
@@ -122,22 +122,40 @@             action                 `shouldThrow`                     (userError "uh oh" ==)-        it "includes a callstack location" $ do-            let-                action =-                    throw TestException-                        `catch`-                            \TestException ->-                                throw TestException-            action-                `Safe.catch`-                        \(e :: AnnotatedException TestException) -> do-                            annotations e-                                `callStackFunctionNamesShouldBe`-                                    [ "throw"-                                    , "throw"-                                    , "catch"-                                    ]++        describe "includes a callstack location" $ do+            it "with an originally annotated exception" $ do+                let+                    action =+                        throw TestException+                            `catch`+                                \TestException ->+                                    throw TestException+                action+                    `Safe.catch`+                            \(e :: AnnotatedException TestException) -> do+                                annotations e+                                    `callStackFunctionNamesShouldBe`+                                        [ "throw"+                                        , "throw"+                                        , "catch"+                                        ]+            it "with a non-annotated original exception" $ do+                let+                    action =+                        Safe.throw TestException+                            `catch`+                                \TestException ->+                                    throw TestException+                action+                    `Safe.catch`+                            \(e :: AnnotatedException TestException) -> do+                                annotations e+                                    `callStackFunctionNamesShouldBe`+                                        [ "throw"+                                        , "catch"+                                        ]+     describe "catches" $ do         it "has a callstack entry" $ do             let