Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Settings
- class HasBugsnagSettings env where
- bugsnagSettingsL :: Lens' env Settings
- notifyBugsnag :: (MonadMask m, MonadUnliftIO m, MonadReader env m, HasBugsnagSettings env, Exception e) => e -> m ()
- notifyBugsnagWith :: (MonadMask m, MonadUnliftIO m, MonadReader env m, HasBugsnagSettings env, Exception e) => BeforeNotify -> e -> m ()
- class HasAppVersion env where
- appVersionL :: Lens' env Text
- setAppVersion :: Text -> BeforeNotify
- envParseBugsnagSettings :: Parser Error Settings
- class Monad m => MonadReader r (m :: Type -> Type) | m -> r
- runReaderT :: ReaderT r m a -> r -> m a
- setInfoSeverity :: BeforeNotify
- setWarningSeverity :: BeforeNotify
- setErrorSeverity :: BeforeNotify
- setDevice :: Device -> BeforeNotify
- setRequest :: Request -> BeforeNotify
- setContext :: Text -> BeforeNotify
- setGroupingHashBy :: (Event -> Maybe Text) -> BeforeNotify
- setGroupingHash :: Text -> BeforeNotify
- updateEventFromOriginalException :: Exception e => (e -> BeforeNotify) -> BeforeNotify
- updateEvent :: (Event -> Event) -> BeforeNotify
- setStackFramesInProjectBy :: (StackFrame -> Bool) -> BeforeNotify
- setStackFramesInProjectByFile :: (FilePath -> Bool) -> BeforeNotify
- setStackFramesInProject :: Bool -> BeforeNotify
- setStackFramesCode :: CodeIndex -> BeforeNotify
- filterStackFrames :: (StackFrame -> Bool) -> BeforeNotify
- updateStackFrames :: (StackFrame -> StackFrame) -> BeforeNotify
- filterExceptions :: (Exception -> Bool) -> BeforeNotify
- updateExceptions :: (Exception -> Exception) -> BeforeNotify
- runBeforeNotify :: Exception e => BeforeNotify -> e -> Event -> Event
- beforeNotify :: (forall e. Exception e => e -> Event -> Event) -> BeforeNotify
- data BeforeNotify
Documentation
Instances
HasBugsnagSettings Settings Source # | |
Defined in Freckle.App.Bugsnag |
class HasBugsnagSettings env where Source #
bugsnagSettingsL :: Lens' env Settings Source #
Instances
HasBugsnagSettings Settings Source # | |
Defined in Freckle.App.Bugsnag | |
HasBugsnagSettings site => HasBugsnagSettings (HandlerData child site) Source # | |
Defined in Freckle.App.Bugsnag bugsnagSettingsL :: Lens' (HandlerData child site) Settings Source # |
notifyBugsnag :: (MonadMask m, MonadUnliftIO m, MonadReader env m, HasBugsnagSettings env, Exception e) => e -> m () Source #
Notify Bugsnag of an exception
The notification is made asynchronously via a simple
. This is
best-effort and we don't care to keep track of the spawned threads.async
notifyBugsnagWith :: (MonadMask m, MonadUnliftIO m, MonadReader env m, HasBugsnagSettings env, Exception e) => BeforeNotify -> e -> m () Source #
notifyBugsnag
with a BeforeNotify
AppVersion
class HasAppVersion env where Source #
appVersionL :: Lens' env Text Source #
Instances
HasAppVersion site => HasAppVersion (HandlerData child site) Source # | |
Defined in Freckle.App.Bugsnag appVersionL :: Lens' (HandlerData child site) Text Source # |
setAppVersion :: Text -> BeforeNotify Source #
Loading settings
Re-exports
class Monad m => MonadReader r (m :: Type -> Type) | m -> r Source #
See examples in Control.Monad.Reader.
Note, the partially applied function type (->) r
is a simple reader monad.
See the instance
declaration below.
Instances
runReaderT :: ReaderT r m a -> r -> m a Source #
setInfoSeverity :: BeforeNotify Source #
Set to InfoSeverity
setWarningSeverity :: BeforeNotify Source #
Set to WarningSeverity
setErrorSeverity :: BeforeNotify Source #
Set to ErrorSeverity
setDevice :: Device -> BeforeNotify Source #
Set the Event's Device
See bugsnagDeviceFromWaiRequest
setRequest :: Request -> BeforeNotify Source #
Set the Event's Request
See bugsnagRequestFromWaiRequest
setContext :: Text -> BeforeNotify Source #
Set the Event's Context
setGroupingHashBy :: (Event -> Maybe Text) -> BeforeNotify Source #
setGroupingHash :: Text -> BeforeNotify Source #
updateEventFromOriginalException :: Exception e => (e -> BeforeNotify) -> BeforeNotify Source #
Update the Event
based on the original exception
This allows updating the Event after casting to an exception type that this
library doesn't know about (e.g. SqlError
). Because the result of your
function is itself a BeforeNotify
, you can (and should) use other
helpers:
myBeforeNotify =defaultBeforeNotify
<>updateEventFromOriginalException
asSqlError <>updateEventFromOriginalException
asHttpError <> -- ... asSqlError :: SqlError -> BeforeNotify asSqlError SqlError{..} =setGroupingHash
sqlErrorCode <>updateException
(e -> e { exception_errorClass = sqlErrorCode , exception_message = Just sqlErrorMessage })
If the cast fails, the event is unchanged.
updateEvent :: (Event -> Event) -> BeforeNotify Source #
setStackFramesInProjectBy :: (StackFrame -> Bool) -> BeforeNotify Source #
setStackFramesInProjectByFile :: (FilePath -> Bool) -> BeforeNotify Source #
filterStackFrames :: (StackFrame -> Bool) -> BeforeNotify Source #
updateStackFrames :: (StackFrame -> StackFrame) -> BeforeNotify Source #
filterExceptions :: (Exception -> Bool) -> BeforeNotify Source #
updateExceptions :: (Exception -> Exception) -> BeforeNotify Source #
runBeforeNotify :: Exception e => BeforeNotify -> e -> Event -> Event Source #
beforeNotify :: (forall e. Exception e => e -> Event -> Event) -> BeforeNotify Source #
data BeforeNotify Source #
A function from Event
to Event
that is applied before notifying
The wrapped function also accepts the original exception, for cases in which
that's useful -- but it's often not. Most BeforeNotify
s use updateEvent
,
which discards it.
BeforeNotify
implements Semigroup
and Monoid
, which means the /do
nothing/ BeforeNotify
is mempty
and two BeforeNotify
s doThis
then
doThat
can be implemented as doThat <> doThis
.
Instances
Monoid BeforeNotify | |
Defined in Network.Bugsnag.BeforeNotify mempty :: BeforeNotify Source # mappend :: BeforeNotify -> BeforeNotify -> BeforeNotify Source # mconcat :: [BeforeNotify] -> BeforeNotify Source # | |
Semigroup BeforeNotify | |
Defined in Network.Bugsnag.BeforeNotify (<>) :: BeforeNotify -> BeforeNotify -> BeforeNotify Source # sconcat :: NonEmpty BeforeNotify -> BeforeNotify Source # stimes :: Integral b => b -> BeforeNotify -> BeforeNotify Source # |