bugsnag 1.2.0.4 → 1.2.0.5
raw patch · 8 files changed
+56/−56 lines, 8 filesdep +freckle-ua-parserdep −ua-parserdep ~aesondep ~annotated-exceptiondep ~bugsnag-hsPVP ok
version bump matches the API change (PVP)
Dependencies added: freckle-ua-parser
Dependencies removed: ua-parser
Dependency ranges changed: aeson, annotated-exception, bugsnag-hs, bytestring, containers, hspec, http-client, parsec, template-haskell, text
API changes (from Hackage documentation)
Files
- bugsnag.cabal +13/−13
- examples/cli/Main.hs +6/−6
- examples/simple/Main.hs +10/−8
- src/Network/Bugsnag/BeforeNotify.hs +6/−6
- src/Network/Bugsnag/CodeIndex.hs +2/−2
- src/Network/Bugsnag/Notify.hs +4/−4
- test/Examples.hs +7/−7
- test/Network/Bugsnag/ExceptionSpec.hs +8/−10
bugsnag.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: bugsnag-version: 1.2.0.4+version: 1.2.0.5 license: MIT license-file: LICENSE maintainer: pbrisbin@gmail.com@@ -48,19 +48,19 @@ build-depends: Glob >=0.9.0,- aeson >=2.0.3.0,- annotated-exception >=0.2.0.4,+ aeson >=2.1.2.1,+ annotated-exception >=0.2.0.5, base >=4.11.0 && <5,- bugsnag-hs >=0.2.0.9,- bytestring >=0.11.4.0,- containers >=0.6.5.1,- http-client >=0.7.13.1,+ bugsnag-hs >=0.2.0.12,+ bytestring >=0.11.5.3,+ containers >=0.6.7,+ freckle-ua-parser >=0.1.2.0,+ http-client >=0.7.15, http-client-tls >=0.3.6.1,- parsec >=3.1.15.0,- template-haskell >=2.18.0.0,- text >=1.2.5.0,+ parsec >=3.1.16.1,+ template-haskell >=2.19.0.0,+ text >=2.0.2, th-lift-instances >=0.1.20,- ua-parser >=0.7.7.0, unliftio >=0.2.25.0, unordered-containers >=0.2.19.1 @@ -129,8 +129,8 @@ TypeApplications TypeFamilies build-depends:- annotated-exception >=0.2.0.4,+ annotated-exception >=0.2.0.5, base >=4.11.0 && <5, bugsnag,- hspec >=2.9.7,+ hspec >=2.10.10, unliftio >=0.2.25.0
examples/cli/Main.hs view
@@ -1,6 +1,6 @@ module Main- ( main- ) where+ ( main+ ) where import Prelude @@ -11,11 +11,11 @@ main :: IO () main = do- let settings = defaultSettings "BUGSNAG_API_KEY"+ let settings = defaultSettings "BUGSNAG_API_KEY" - appMain `catch` \ex -> do- notifyBugsnag @SomeException settings ex- die $ show ex+ appMain `catch` \ex -> do+ notifyBugsnag @SomeException settings ex+ die $ show ex -- Actual program logic appMain :: IO ()
examples/simple/Main.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE TemplateHaskell #-} module Main- ( main- ) where+ ( main+ ) where import Prelude @@ -14,10 +14,12 @@ main :: IO () main = do- let settings = defaultSettings "BUGSNAG_API_KEY"+ let settings = defaultSettings "BUGSNAG_API_KEY" - notifyBugsnag settings $ AsException $ defaultException- { exception_errorClass = "Error"- , exception_message = Just "message"- , exception_stacktrace = [$(currentStackFrame) "myFunction"]- }+ notifyBugsnag settings+ $ AsException+ $ defaultException+ { exception_errorClass = "Error"+ , exception_message = Just "message"+ , exception_stacktrace = [$(currentStackFrame) "myFunction"]+ }
src/Network/Bugsnag/BeforeNotify.hs view
@@ -63,20 +63,20 @@ runBeforeNotify (BeforeNotify f) = f . Exception.toException updateExceptions :: (Exception -> Exception) -> BeforeNotify-updateExceptions f = updateEvent $- \event -> event {event_exceptions = map f $ event_exceptions event}+updateExceptions f = updateEvent+ $ \event -> event {event_exceptions = map f $ event_exceptions event} filterExceptions :: (Exception -> Bool) -> BeforeNotify filterExceptions p = updateEvent $ \event -> event {event_exceptions = filter p $ event_exceptions event} updateStackFrames :: (StackFrame -> StackFrame) -> BeforeNotify-updateStackFrames f = updateExceptions $- \e -> e {exception_stacktrace = map f $ exception_stacktrace e}+updateStackFrames f = updateExceptions+ $ \e -> e {exception_stacktrace = map f $ exception_stacktrace e} filterStackFrames :: (StackFrame -> Bool) -> BeforeNotify-filterStackFrames p = updateExceptions $- \e -> e {exception_stacktrace = filter p $ exception_stacktrace e}+filterStackFrames p = updateExceptions+ $ \e -> e {exception_stacktrace = filter p $ exception_stacktrace e} setStackFramesCode :: CodeIndex -> BeforeNotify setStackFramesCode =
src/Network/Bugsnag/CodeIndex.hs view
@@ -71,5 +71,5 @@ findSourceRange path (begin, end) index = do FileIndex {..} <- Map.lookup path $ unCodeIndex index - for [begin .. min end fiLastLine] $- \n -> (n,) <$> Map.lookup n fiSourceLines+ for [begin .. min end fiLastLine]+ $ \n -> (n,) <$> Map.lookup n fiSourceLines
src/Network/Bugsnag/Notify.hs view
@@ -37,8 +37,8 @@ buildEvent :: Exception.Exception e => BeforeNotify -> e -> Event buildEvent bn e =- runBeforeNotify bn e $- defaultEvent+ runBeforeNotify bn e+ $ defaultEvent { event_exceptions = [ex] , event_metaData = unMetaData <$> metaDataFromException e }@@ -67,8 +67,8 @@ setApp event = event { event_app =- Just $- defaultApp+ Just+ $ defaultApp { app_version = settings_appVersion , app_releaseStage = Just settings_releaseStage }
test/Examples.hs view
@@ -25,13 +25,13 @@ brokenFunctionIO :: IO a brokenFunctionIO =- throw $- AsException $- defaultException- { exception_errorClass = "IOException"- , exception_message = Just "Something exploded"- , exception_stacktrace = [$(currentStackFrame) "brokenFunctionIO"]- }+ throw+ $ AsException+ $ defaultException+ { exception_errorClass = "IOException"+ , exception_message = Just "Something exploded"+ , exception_stacktrace = [$(currentStackFrame) "brokenFunctionIO"]+ } brokenFunction :: HasCallStack => a brokenFunction = sillyHead [] `seq` undefined
test/Network/Bugsnag/ExceptionSpec.hs view
@@ -27,18 +27,16 @@ let (frame : _) = exception_stacktrace ex stackFrame_file frame `shouldBe` "test/Examples.hs" stackFrame_lineNumber frame `shouldBe` 33- -- different versions of GHC disagree on where splices start- stackFrame_columnNumber frame- `shouldSatisfy` (`elem` [Just 36, Just 37])+ stackFrame_columnNumber frame `shouldBe` Just 34 stackFrame_method frame `shouldBe` "brokenFunctionIO" stackFrame_inProject frame `shouldBe` Just True describe "bugsnagExceptionFromSomeException" $ do it "sets errorClass" $ do let ex =- bugsnagExceptionFromSomeException $- toException $- userError "Oops"+ bugsnagExceptionFromSomeException+ $ toException+ $ userError "Oops" exception_errorClass ex `shouldBe` "IOException" exception_message ex `shouldBe` Just "user error (Oops)"@@ -50,9 +48,9 @@ it "unwraps AnnotatedException, setting errorClass to the wrapped type" $ do let ex =- bugsnagExceptionFromSomeException $- toException $- AnnotatedException [] Whatever+ bugsnagExceptionFromSomeException+ $ toException+ $ AnnotatedException [] Whatever exception_errorClass ex `shouldBe` "Whatever" @@ -148,7 +146,7 @@ let (lastFrame : _) = reverse ourFrames stackFrame_file lastFrame `shouldBe` "test/Network/Bugsnag/ExceptionSpec.hs"- stackFrame_lineNumber lastFrame `shouldBe` 136+ stackFrame_lineNumber lastFrame `shouldBe` 134 it "prefers the earliest attached Backtraces when more than one is present" $ do e <- brokenFunctionBacktraceCheckpointed `catch` pure