packages feed

bugsnag 1.2.0.0 → 1.2.0.1

raw patch · 4 files changed

+79/−37 lines, 4 filesdep ~aesondep ~annotated-exceptiondep ~containersPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: aeson, annotated-exception, containers, hspec, template-haskell, th-lift-instances, ua-parser, unliftio, unordered-containers

API changes (from Hackage documentation)

+ Network.Bugsnag.Exception.Context: data ExceptionWithContext e
+ Network.Bugsnag.Exception.Context: displayExceptionWithContext :: Exception e => ExceptionWithContext e -> String
+ Network.Bugsnag.Exception.Context: instance GHC.Classes.Eq e => GHC.Classes.Eq (Network.Bugsnag.Exception.Context.ExceptionWithContext e)
+ Network.Bugsnag.Exception.Context: instance GHC.Exception.Type.Exception e => GHC.Exception.Type.Exception (Network.Bugsnag.Exception.Context.ExceptionWithContext e)
+ Network.Bugsnag.Exception.Context: instance GHC.Show.Show e => GHC.Show.Show (Network.Bugsnag.Exception.Context.ExceptionWithContext e)
+ Network.Bugsnag.Exception.Parse: parseExceptionWithContext :: ExceptionWithContext SomeException -> Either String MessageWithStackFrames

Files

bugsnag.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.18 name:               bugsnag-version:            1.2.0.0+version:            1.2.0.1 license:            MIT license-file:       LICENSE maintainer:         pbrisbin@gmail.com@@ -28,6 +28,7 @@         Network.Bugsnag.CodeIndex         Network.Bugsnag.Device         Network.Bugsnag.Exception+        Network.Bugsnag.Exception.Context         Network.Bugsnag.Exception.Parse         Network.Bugsnag.MetaData         Network.Bugsnag.Notify@@ -47,21 +48,21 @@      build-depends:         Glob >=0.9.0,-        aeson >=1.3.1.1,-        annotated-exception >=0.2.0.2,+        aeson >=1.4.2.0,+        annotated-exception >=0.2.0.3,         base >=4.11.0 && <5,         bugsnag-hs >=0.2.0.8,         bytestring >=0.10.8.2,-        containers >=0.5.11.0,+        containers >=0.6.0.1,         http-client >=0.5.14,         http-client-tls >=0.3.5.3,         parsec >=3.1.13.0,-        template-haskell >=2.13.0.0,+        template-haskell >=2.14.0.0,         text >=1.2.3.1,-        th-lift-instances >=0.1.11,-        ua-parser >=0.7.7.0,-        unliftio >=0.2.9.0,-        unordered-containers >=0.2.9.0+        th-lift-instances >=0.1.12,+        ua-parser >=0.7.5.1,+        unliftio >=0.2.11,+        unordered-containers >=0.2.10.0  executable example-cli     main-is:            Main.hs@@ -128,8 +129,8 @@         TypeApplications TypeFamilies      build-depends:-        annotated-exception >=0.2.0.2,+        annotated-exception >=0.2.0.3,         base >=4.11.0 && <5,         bugsnag,-        hspec >=2.5.5,-        unliftio >=0.2.9.0+        hspec >=2.6.1,+        unliftio >=0.2.11
src/Network/Bugsnag/Exception.hs view
@@ -95,6 +95,8 @@         parseResult =           asum             [ fromException (Annotated.exception ae)+                >>= (either (const Nothing) Just . parseExceptionWithContext)+            , fromException (Annotated.exception ae)                 >>= (either (const Nothing) Just . parseErrorCall)             , either (const Nothing) Just $                 parseStringException (Annotated.exception ae)
+ src/Network/Bugsnag/Exception/Context.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE CPP #-}++module Network.Bugsnag.Exception.Context+  ( ExceptionWithContext+  , displayExceptionWithContext+  ) where++import Prelude++#if MIN_VERSION_base(4,20,0)+import Control.Exception (Exception, ExceptionWithContext(..), displayException)+import Control.Exception.Context ( displayExceptionContext)++displayExceptionWithContext :: Exception e => ExceptionWithContext e -> String+displayExceptionWithContext (ExceptionWithContext anns e) =+  displayException e <> "\n" <> displayExceptionContext anns+#else+import Control.Exception (Exception, displayException)++newtype ExceptionWithContext e = ExceptionWithContext e+  deriving newtype (Eq, Show, Exception)++displayExceptionWithContext :: Exception e => ExceptionWithContext e -> String+displayExceptionWithContext (ExceptionWithContext ex) = displayException ex+#endif
src/Network/Bugsnag/Exception/Parse.hs view
@@ -4,20 +4,18 @@ module Network.Bugsnag.Exception.Parse   ( MessageWithStackFrames (..)   , parseErrorCall+  , parseExceptionWithContext   , parseStringException   ) where  import Prelude -import qualified Control.Exception as Exception-  ( ErrorCall-  , Exception-  , SomeException-  )+import qualified Control.Exception as Exception (ErrorCall, SomeException) import Control.Monad (void) import Data.Bifunctor (first) import Data.Bugsnag import Data.Text (Text, pack)+import qualified Network.Bugsnag.Exception.Context as Exception import Text.Parsec import Text.Parsec.String @@ -28,8 +26,14 @@  -- | Parse an @'ErrorCall'@ for @'HasCallStack'@ information parseErrorCall :: Exception.ErrorCall -> Either String MessageWithStackFrames-parseErrorCall = parse' errorCallParser+parseErrorCall = parse' errorCallParser . show +parseExceptionWithContext+  :: Exception.ExceptionWithContext Exception.SomeException+  -> Either String MessageWithStackFrames+parseExceptionWithContext =+  parse' backtraceParser . Exception.displayExceptionWithContext+ -- | Parse a @'StringException'@ for @'HasCallStack'@ information -- -- We accept this as @'SomeException'@ so that this library doesn't depend on@@ -37,7 +41,7 @@ -- sigh.) parseStringException   :: Exception.SomeException -> Either String MessageWithStackFrames-parseStringException = parse' stringExceptionParser+parseStringException = parse' stringExceptionParser . show  -- brittany-disable-next-binding @@ -45,28 +49,39 @@ errorCallParser =   MessageWithStackFrames     <$> messageParser-    <*> manyTill stackFrameParser eof+    <*> manyTill hasCallStackStackFrameParser eof  where   messageParser :: Parser Text   messageParser = do     msg <- pack <$> manyTill anyChar eol     msg <$ (string "CallStack (from HasCallStack):" *> eol) -  stackFrameParser :: Parser StackFrame-  stackFrameParser = do-    func <- stackFrameFunctionTill $ string ", called at "-    (path, ln, cl) <- stackFrameLocationTill $ eol <|> eof+backtraceParser :: Parser MessageWithStackFrames+backtraceParser =+  MessageWithStackFrames+    <$> messageParser+    <*> manyTill hasCallStackStackFrameParser eof+ where+  messageParser :: Parser Text+  messageParser = do+    msg <- pack <$> manyTill anyChar eol+    msg <$ (string "HasCallStack backtrace:" *> eol) -    pure-      defaultStackFrame-        { stackFrame_file = pack path-        , stackFrame_lineNumber = ln-        , stackFrame_columnNumber = Just cl-        , stackFrame_method = func-        , stackFrame_inProject = Just True-        , stackFrame_code = Nothing-        }+hasCallStackStackFrameParser :: Parser StackFrame+hasCallStackStackFrameParser = do+  func <- stackFrameFunctionTill $ string ", called at "+  (path, ln, cl) <- stackFrameLocationTill $ eol <|> eof +  pure+    defaultStackFrame+      { stackFrame_file = pack path+      , stackFrame_lineNumber = ln+      , stackFrame_columnNumber = Just cl+      , stackFrame_method = func+      , stackFrame_inProject = Just True+      , stackFrame_code = Nothing+      }+ -- brittany-disable-next-binding  stringExceptionParser :: Parser MessageWithStackFrames@@ -114,11 +129,10 @@   pure result  parse'-  :: Exception.Exception e-  => Parser MessageWithStackFrames-  -> e+  :: Parser MessageWithStackFrames+  -> String   -> Either String MessageWithStackFrames-parse' p = first show . parse (p <* eof) "<error>" . show+parse' p = first show . parse (p <* eof) "<error>"  eol :: Parser () eol = void endOfLine