bugsnag-haskell-0.0.1.2: Bugsnag error reporter for Haskell

Safe HaskellNone
LanguageHaskell2010

Network.Bugsnag.Exception

Synopsis

Documentation

data BugsnagException Source #

Instances

Show BugsnagException Source # 
Generic BugsnagException Source # 
ToJSON BugsnagException Source # 
Exception BugsnagException Source # 
type Rep BugsnagException Source # 
type Rep BugsnagException = D1 * (MetaData "BugsnagException" "Network.Bugsnag.Exception" "bugsnag-haskell-0.0.1.2-H7lLM1Kbg5G6PLZA4BTFv" False) (C1 * (MetaCons "BugsnagException" PrefixI True) ((:*:) * ((:*:) * (S1 * (MetaSel (Just Symbol "beErrorClass") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Text)) (S1 * (MetaSel (Just Symbol "beMessage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Maybe Text)))) ((:*:) * (S1 * (MetaSel (Just Symbol "beStacktrace") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * [BugsnagStackFrame])) (S1 * (MetaSel (Just Symbol "beOriginalException") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (Maybe SomeException))))))

bugsnagException :: Text -> Text -> [BugsnagStackFrame] -> BugsnagException Source #

Construct a throwable BugsnagException

Note that Message is optional in the API, but we consider it required because that's just silly. To include a stack frame from the location of construction via Template Haskell, see currentStackFrame.

bugsnagExceptionFromSomeException :: SomeException -> BugsnagException Source #

Construct a BugsnagException from a SomeException

BugsnagExceptions are left as-is, and ErrorCall exceptions are parsed for HasCallStack information to use as stacktrace. Otherwise, we attempt to determine errorClass and we use the shown exception as message.

>>> import Control.Arrow
>>> import System.IO.Error
>>> (beErrorClass &&& beMessage) $ bugsnagExceptionFromSomeException $ toException $ userError "Oops"
("IOException",Just "user error (Oops)")