This means that we can't rely on application state in the global
before-notify. For example:
, bsBeforeNotify = \event -> do
request <- waiRequest
pure $ updateEventFromRequest request event
-- Later
notifyBugsnag settings ex
Instead, we can only do pure things there:
, bsBeforeNotify = setWarning
And need to use notifyBugsnagWith for other stuff:
errorHandler (InternalError msg) = do
request <- waiRequest
let ex = bugsnagExceptionFromErrorMessage msg
beforeNotify = updateEventFromRequest request
notifyBugsnagWith beforeNotify settings ex
This may be perfectly acceptable and worth the simplification. The only
real downside is that we can't use catchBugsnag as-is if we want to be
able to inject a context-aware before-notify. Of course, we could
implement a catchBugsnagWith if that becomes problematic.
This means that we can't rely on application state in the global before-notify. For example:
Instead, we can only do pure things there:
And need to use notifyBugsnagWith for other stuff:
This may be perfectly acceptable and worth the simplification. The only real downside is that we can't use catchBugsnag as-is if we want to be able to inject a context-aware before-notify. Of course, we could implement a catchBugsnagWith if that becomes problematic.