Skip to content

Commit 3be0405

Browse files
committed
support annotations, update stack, add nix
1 parent 3ff0de5 commit 3be0405

File tree

13 files changed

+398
-11
lines changed

13 files changed

+398
-11
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
stack-yaml:
1515
- stack.yaml
1616
- stack-nightly.yaml
17+
- stack-lts-20.26.yaml
1718
- stack-lts-18.28.yaml
1819
- stack-lts-16.31.yaml
1920
- stack-lts-14.27.yaml

bugsnag/CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
## [_Unreleased_](https://github.com/pbrisbin/bugsnag-haskell/compare/bugsnag-v1.0.0.1...main)
1+
## [_Unreleased_](https://github.com/pbrisbin/bugsnag-haskell/compare/bugsnag-v1.0.1.0...main)
22

33
- None
44

5+
## [v1.0.1.0](https://github.com/pbrisbin/bugsnag-haskell/compare/bugsnag-v1.0.0.0...bugsnag-v1.0.1.0)
6+
7+
- Adds some support for the `annotated-exception` package.
8+
`updateEventFromOriginalException` now catches either `e` or `AnnotatedException e`.
9+
(This is technically a breaking change, but either it doesn't affect you
10+
or is most likely the behavior you want.)
11+
The new `updateEventFromOriginalAnnotatedException` utility can be used to inspect
12+
the original exception's annotations.
13+
514
## [v1.0.0.1](https://github.com/pbrisbin/bugsnag-haskell/compare/bugsnag-v1.0.0.0...bugsnag-v1.0.0.1)
615

716
- Support GHCs 9.0 and 9.2

bugsnag/bugsnag.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ cabal-version: 1.18
55
-- see: https://github.com/sol/hpack
66

77
name: bugsnag
8-
version: 1.0.0.1
8+
version: 1.0.1.0
99
synopsis: Bugsnag error reporter for Haskell
1010
description: Please see README.md
1111
category: Web
@@ -69,6 +69,7 @@ library
6969
TypeFamilies
7070
build-depends:
7171
Glob >=0.9.0
72+
, annotated-exception
7273
, base >=4.11.0 && <5
7374
, bugsnag-hs
7475
, bytestring

bugsnag/package.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: bugsnag
2-
version: 1.0.0.1
2+
version: 1.0.1.0
33
synopsis: Bugsnag error reporter for Haskell
44
description: Please see README.md
55
homepage: https://github.com/pbrisbin/bugsnag-haskell#readme
@@ -48,6 +48,7 @@ library:
4848
source-dirs: src
4949
dependencies:
5050
- Glob >= 0.9.0
51+
- annotated-exception
5152
- bugsnag-hs
5253
- bytestring
5354
- containers

bugsnag/src/Network/Bugsnag/BeforeNotify.hs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module Network.Bugsnag.BeforeNotify
1616
-- * Modifying the Event
1717
, updateEvent
1818
, updateEventFromOriginalException
19+
, updateEventFromOriginalAnnotatedException
1920
, setGroupingHash
2021
, setGroupingHashBy
2122
, setDevice
@@ -29,6 +30,8 @@ module Network.Bugsnag.BeforeNotify
2930
import Prelude
3031

3132
import qualified Control.Exception as Exception
33+
import Control.Exception.Annotated (AnnotatedException)
34+
import qualified Control.Exception.Annotated as Annotated
3235
import Data.Bugsnag
3336
import Data.Maybe (isJust)
3437
import Data.Text (Text, unpack)
@@ -123,9 +126,22 @@ updateEvent f = beforeNotify $ \_e event -> f event
123126
--
124127
-- If the cast fails, the event is unchanged.
125128
--
129+
-- The cast will match either @e@ or @'AnnotatedException' e@.
130+
--
126131
updateEventFromOriginalException
127132
:: forall e . Exception.Exception e => (e -> BeforeNotify) -> BeforeNotify
128-
updateEventFromOriginalException f = beforeNotify $ \e event ->
133+
updateEventFromOriginalException f =
134+
updateEventFromOriginalAnnotatedException (f . Annotated.exception)
135+
136+
-- | Like 'updateEventFromOriginalException', but gives the result
137+
-- as an 'AnnotatedException'
138+
--
139+
-- If the original exception was not wrapped in 'AnnotatedException', it
140+
-- will match as an 'AnnotatedException' with an empty annotation list.
141+
updateEventFromOriginalAnnotatedException
142+
:: forall e . Exception.Exception e
143+
=> (AnnotatedException e -> BeforeNotify) -> BeforeNotify
144+
updateEventFromOriginalAnnotatedException f = beforeNotify $ \e event ->
129145
let bn = maybe mempty f $ Exception.fromException $ Exception.toException e
130146
in runBeforeNotify bn e event
131147

cabal.project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: bugsnag, bugsnag-wai, bugsnag-yesod

flake.lock

Lines changed: 251 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)