bugsnag: Bugsnag error reporter for Haskell

[ library, mit, web ] [ Propose Tags ] [ Report a vulnerability ]

Please see README.md


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
examples

Build the examples

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0.0, 1.0.0.1, 1.1.0.0, 1.1.0.1
Change log CHANGELOG.md
Dependencies aeson (>=1.3.1.1), annotated-exception (>=0.2.0.2), base (>=4.11.0 && <5), bugsnag, bugsnag-hs (>=0.2.0.8), bytestring (>=0.10.8.2), containers (>=0.5.11.0), Glob (>=0.9.0), http-client (>=0.5.14), http-client-tls (>=0.3.5.3), parsec (>=3.1.13.0), template-haskell (>=2.13.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) [details]
License MIT
Author Patrick Brisbin
Maintainer pbrisbin@gmail.com
Category Web
Home page https://github.com/pbrisbin/bugsnag-haskell#readme
Uploaded by PatrickBrisbin at 2024-12-12T22:33:02Z
Distributions LTSHaskell:1.1.0.1, NixOS:1.1.0.0, Stackage:1.1.0.1
Reverse Dependencies 3 direct, 0 indirect [details]
Executables example-simple, example-cli
Downloads 511 total (28 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2024-12-13 [all 1 reports]

Readme for bugsnag-1.1.0.1

[back to package description]

Bugsnag error reporter for Haskell

Hackage Stackage Nightly Stackage LTS

Catch exceptions in your Haskell code and report then to Bugsnag.

Configuration

let settings = defaultSettings "A_BUGSNAG_API_KEY"

Manual Reporting

Data.Bugsnag.Exception is the type of actual exceptions included in the event reported to Bugsnag. Constructing it directly can be useful to attach the current source location as a stack frame.

let
  ex = defaultException
    { exception_errorClass = "Error"
    , exception_message = Just "message"
    , exception_stacktrace = [$(currentStackFrame) "myFunction"]
    }

In order to treat it like an actual Haskell Exception (including to report it), wrap it in AsException:

notifyBugsnag settings $ AsException ex

Catching & Throwing

Catch any exceptions, notify, and re-throw:

myFunction `withException` notifyBugsnag @SomeException settings

Throw a manually-built exception:

throwIO $ AsException ex

Examples

Examples can be built locally with:

stack build --flag bugsnag:examples

bugsnag-hs

We depend on bugsnag-hs to define the types for the full reporting API payload. Unfortunately, it exposes them from its own Network.Bugsnag module, which conflicts with ourselves.

To get around this, we re-export that whole module as Data.Bugsnag. If you are currently depending on bugsnag-hs and wish to use our package too, we recommend you only depend on us and use its types through the Data.Bugsnag re-export.


CHANGELOG | LICENSE