bugsnag-yesod 1.0.0.1 → 1.0.1.0
raw patch · 4 files changed
+30/−7 lines, 4 filesdep +annotated-exceptionPVP ok
version bump matches the API change (PVP)
Dependencies added: annotated-exception
API changes (from Hackage documentation)
Files
- CHANGELOG.md +11/−1
- README.md +5/−0
- bugsnag-yesod.cabal +3/−2
- src/Network/Bugsnag/Yesod.hs +11/−4
CHANGELOG.md view
@@ -1,6 +1,16 @@-## [_Unreleased_](https://github.com/pbrisbin/bugsnag-haskell/compare/bugsnag-yesod-v1.0.0.1...main)+## [_Unreleased_](https://github.com/pbrisbin/bugsnag-haskell/compare/bugsnag-yesod-v1.0.1.0...main) - None++## [v1.0.1.0](https://github.com/pbrisbin/bugsnag-haskell/compare/bugsnag-yesod-v1.0.0.1...v1.0.1.0)++- Adds support for `annotated-exception`++ The Bugsnag middleware avoids catching `HandlerContents`, because this particular+ exception represents Yesod control flow, not an exception that needs to be reported.+ With this change, it also avoids catching `AnnotatedException HandlerContents`.+ This preserves the correct behavior even if the `HandlerContents` exception ended+ up being rethrown by one of the utilities in the `annotated-exception` package. ## [v1.0.0.1](https://github.com/pbrisbin/bugsnag-haskell/compare/bugsnag-yesod-v1.0.0.0...bugsnag-yesod-v1.0.0.1)
README.md view
@@ -1,5 +1,10 @@ # Yesod integration for Bugsnag +[](https://hackage.haskell.org/package/bugsnag-yesod)+[](http://stackage.org/nightly/package/bugsnag-yesod)+[](http://stackage.org/lts/package/bugsnag-yesod)++ ## Examples - [Yesod/Warp](./example/Main.hs)
bugsnag-yesod.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: bugsnag-yesod-version: 1.0.0.1+version: 1.0.1.0 license: MIT license-file: LICENSE maintainer: pbrisbin@gmail.com@@ -33,6 +33,7 @@ TypeApplications TypeFamilies build-depends:+ annotated-exception >=0.2.0.2, base >=4.11.0 && <5, bugsnag >=1.0.0.1, bugsnag-wai >=1.0.0.1,@@ -57,7 +58,7 @@ build-depends: base >=4.11.0 && <5, bugsnag >=1.0.0.1,- bugsnag-yesod -any,+ bugsnag-yesod, warp >=3.2.25, yesod-core >1.6
src/Network/Bugsnag/Yesod.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE AllowAmbiguousTypes #-}+ -- | A 'yesodMiddleware' that notifies Bugsnag of exceptions -- -- 'yesodMiddleware' is the only way to handle things as actual exceptions. The@@ -15,13 +17,16 @@ import Prelude +import Control.Exception.Annotated (AnnotatedException) import Control.Monad (unless) import Control.Monad.IO.Class (liftIO) import Data.Bugsnag.Settings+import Data.Maybe (isJust) import Network.Bugsnag import Network.Bugsnag.Wai import qualified Network.Wai as Wai-import UnliftIO.Exception (SomeException, fromException, withException)+import UnliftIO.Exception+ (Exception, SomeException, fromException, withException) import Yesod.Core (forkHandler, getsYesod, waiRequest) import Yesod.Core.Types (HandlerContents, HandlerFor) @@ -45,6 +50,8 @@ $ notifyBugsnagWith (mkBeforeNotify request) settings ex isHandlerContents :: SomeException -> Bool-isHandlerContents ex = case (fromException ex :: Maybe HandlerContents) of- Just _ -> True- Nothing -> False+isHandlerContents ex =+ is @HandlerContents ex || is @(AnnotatedException HandlerContents) ex++is :: forall e . Exception e => SomeException -> Bool+is = isJust . fromException @e