packages feed

freckle-app 1.11.0.0 → 1.12.0.0

raw patch · 6 files changed

+20/−161 lines, 6 filesdep ~basedep ~bugsnag

Dependency ranges changed: base, bugsnag

Files

CHANGELOG.md view
@@ -1,4 +1,13 @@-## [_Unreleased_](https://github.com/freckle/freckle-app/compare/v1.11.0.0...main)+## [_Unreleased_](https://github.com/freckle/freckle-app/compare/v1.12.0.0...main)++## [v1.12.0.0](https://github.com/freckle/freckle-app/compare/v1.11.0.0...v1.12.0.0)++- Support `bugsnag-1.1` which now handles `AnnotatedException` well, so we've now+  removed some `BeforeNotify` handlers from this package that are no longer needed.+- Removed `Freckle.App.Bugsnag.MetaData.metaDataAnnotationsBeforeNotify`; what it+  did is now redundant to the default behavior of the `bugsnag` library.+- Removed module `Freckle.App.Bugsnag.CallStack`; what it provided is now redundant+  to the default behavior of the `bugsnag` library.  ## [v1.11.0.0](https://github.com/freckle/freckle-app/compare/v1.10.8.0...v1.11.0.0) 
freckle-app.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.18 name:               freckle-app-version:            1.11.0.0+version:            1.12.0.0 license:            MIT license-file:       LICENSE maintainer:         Freckle Education@@ -26,7 +26,6 @@         Freckle.App.Aeson         Freckle.App.Async         Freckle.App.Bugsnag-        Freckle.App.Bugsnag.CallStack         Freckle.App.Bugsnag.HttpException         Freckle.App.Bugsnag.MetaData         Freckle.App.Bugsnag.SqlError@@ -101,9 +100,9 @@         annotated-exception >=0.2.0.5,         aws-xray-client-persistent >=0.1.0.5,         aws-xray-client-wai >=0.1.0.2,-        base >=4.14.3.0,+        base >=4.14.3.0 && <5,         bcp47 >=0.2.0.6,-        bugsnag >=1.0.0.0,+        bugsnag >=1.1.0.0,         bytestring >=0.10.12.0,         case-insensitive >=1.2.1.0,         cassava >=0.5.2.0,@@ -256,7 +255,7 @@         QuickCheck >=2.14.2,         aeson >=1.5.6.0,         base >=4.14.3.0 && <5,-        bugsnag >=1.0.0.0,+        bugsnag >=1.1.0.0,         bytestring >=0.10.12.0,         cassava >=0.5.2.0,         conduit >=1.3.4.2,
library/Freckle/App/Bugsnag.hs view
@@ -27,9 +27,7 @@ import Data.Bugsnag.Settings (Settings (..), defaultSettings) import Data.List (isInfixOf) import Freckle.App.Async (async)-import Freckle.App.Bugsnag.CallStack (callStackBeforeNotify) import Freckle.App.Bugsnag.HttpException (httpExceptionBeforeNotify)-import Freckle.App.Bugsnag.MetaData (metaDataAnnotationsBeforeNotify) import Freckle.App.Bugsnag.SqlError (sqlErrorBeforeNotify) import qualified Freckle.App.Env as Env import Network.Bugsnag hiding (notifyBugsnag, notifyBugsnagWith)@@ -111,8 +109,6 @@  globalBeforeNotify :: BeforeNotify globalBeforeNotify =-  callStackBeforeNotify-    <> metaDataAnnotationsBeforeNotify-    <> sqlErrorBeforeNotify+  sqlErrorBeforeNotify     <> httpExceptionBeforeNotify     <> maskErrorHelpers
− library/Freckle/App/Bugsnag/CallStack.hs
@@ -1,46 +0,0 @@-module Freckle.App.Bugsnag.CallStack-  ( callStackBeforeNotify-  , attachCallStack-  , callStackToStackFrames-  , callSiteToStackFrame--    -- * Re-exports-  , CallStack-  , SrcLoc-  , StackFrame-  ) where--import Freckle.App.Prelude--import Control.Exception.Annotated (annotatedExceptionCallStack)-import Data.Bugsnag (Exception (..), StackFrame (..), defaultStackFrame)-import qualified Data.Text as T-import Freckle.App.Exception.Types (AnnotatedException)-import GHC.Stack (CallStack, SrcLoc (..), getCallStack)-import Network.Bugsnag (BeforeNotify, updateExceptions)-import Network.Bugsnag.BeforeNotify (updateEventFromOriginalException)---- | Copy the call stack from an AnnotatedException-callStackBeforeNotify :: BeforeNotify-callStackBeforeNotify =-  updateEventFromOriginalException @(AnnotatedException SomeException) $ \e ->-    foldMap attachCallStack $ annotatedExceptionCallStack e--attachCallStack :: CallStack -> BeforeNotify-attachCallStack cs =-  updateExceptions $ \ex ->-    ex {exception_stacktrace = callStackToStackFrames cs}---- | Converts a GHC call stack to a list of stack frames suitable---   for use as the stacktrace in a Bugsnag exception-callStackToStackFrames :: CallStack -> [StackFrame]-callStackToStackFrames = fmap callSiteToStackFrame . getCallStack--callSiteToStackFrame :: (String, SrcLoc) -> StackFrame-callSiteToStackFrame (str, loc) =-  defaultStackFrame-    { stackFrame_method = T.pack str-    , stackFrame_file = T.pack $ srcLocFile loc-    , stackFrame_lineNumber = srcLocStartLine loc-    , stackFrame_columnNumber = Just $ srcLocStartCol loc-    }
library/Freckle/App/Bugsnag/MetaData.hs view
@@ -11,55 +11,19 @@      -- * 'BeforeNotify'   , mergeMetaData-  , metaDataAnnotationsBeforeNotify   ) where  import Freckle.App.Prelude -import Blammo.Logging (Pair, myThreadContext)-import Control.Exception.Annotated (AnnotatedException, annotations)+import Blammo.Logging (myThreadContext) import Control.Lens (Lens', lens, to, view, (<>~))-import Data.Aeson (KeyValue ((.=)), Object, Value (..), object)-import Data.Annotation (tryAnnotations)+import Data.Aeson (Value (..)) import Data.Bugsnag (Event (..)) import Data.String (fromString) import qualified Freckle.App.Aeson as Aeson import Freckle.App.Stats (HasStatsClient (..), tagsL)-import Network.Bugsnag-  ( BeforeNotify-  , updateEvent-  , updateEventFromOriginalException-  )--newtype MetaData = MetaData-  { unMetaData :: Object-  }-  deriving stock (Eq, Show)--instance Semigroup MetaData where-  -- \| /Right/-biased, recursive union-  ---  -- The chosen bias ensures that adding metadata in smaller scopes (later)-  -- overrides values from larger scopes.-  MetaData x <> MetaData y = MetaData $ unionObjects y x-   where-    unionObjects :: Object -> Object -> Object-    unionObjects = Aeson.unionWith unionValues--    unionValues (Object a) (Object b) = Object $ unionObjects a b-    unionValues a _ = a--instance Monoid MetaData where-  mempty = MetaData mempty---- | Construct 'MetaData' from 'Pair's-metaData-  :: Aeson.Key-  -- ^ The Tab within which the values will display-  -> [Pair]-  -- ^ The Key-Values themselves-  -> MetaData-metaData key = MetaData . Aeson.fromList . pure . (key .=) . object+import Network.Bugsnag (BeforeNotify, updateEvent)+import Network.Bugsnag.MetaData  metaDataL :: Lens' Event MetaData metaDataL = lens get set@@ -92,65 +56,3 @@ -- preserving the incoming values on collisions. mergeMetaData :: MetaData -> BeforeNotify mergeMetaData md = updateEvent $ metaDataL <>~ md---- $details------ From <https://bugsnagerrorreportingapi.docs.apiary.io/#reference/0/notify/send-error-reports>------ @events[].metaData@------ > An object containing any further data you wish to attach to this error--- > event. This should contain one or more objects, with each object being--- > displayed in its own tab on the event details on Bugsnag.--- >--- > {--- >     // Custom user data to be displayed in the User tab along with standard--- >     // user fields on the Bugsnag website.--- >     "user": {--- >        ...--- >     },--- >--- >     // Custom app data to be displayed in the App tab along with standard--- >     // app fields on the Bugsnag website.--- >     "app": {--- >        ...--- >     },--- >--- >     // Custom device data to be displayed in the Device tab along with--- >     //standard device fields on the Bugsnag website.--- >     "device": {--- >        ...--- >     },--- >--- >     Custom request data to be displayed in the Request tab along with--- >     standard request fields on the Bugsnag website.--- >     "request": {--- >        ...--- >     },--- >--- >     // This will be displayed as an extra tab on the Bugsnag website.--- >     "Some data": {--- >--- >         // A key value pair that will be displayed in the first tab.--- >         "key": "value",--- >--- >         // Key value pairs can be contained in nested objects which helps--- >         // to organise the information presented in the tab.--- >         "setOfKeys": {--- >             "key": "value",--- >             "key2": "value"--- >         }--- >     },--- >--- >     // This would be the second extra tab on the Bugsnag website.--- >     "Some more data": {--- >         ...--- >     }--- > }---- | If any 'MetaData' values are present among the original exception's---   annotations, merge them into the Bugsnag event's metadata.-metaDataAnnotationsBeforeNotify :: BeforeNotify-metaDataAnnotationsBeforeNotify =-  updateEventFromOriginalException @(AnnotatedException SomeException) $-    foldMap mergeMetaData . fst . tryAnnotations @MetaData . annotations
package.yaml view
@@ -1,5 +1,5 @@ name: freckle-app-version: 1.11.0.0+version: 1.12.0.0 maintainer: Freckle Education category: Utils github: freckle/freckle-app@@ -75,7 +75,6 @@     - annotated-exception     - aws-xray-client-persistent     - aws-xray-client-wai-    - base     - bcp47     - bugsnag     - bytestring