| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.Bugsnag.BeforeNotify
Contents
Synopsis
- type BeforeNotify = BugsnagEvent -> BugsnagEvent
- defaultBeforeNotify :: BeforeNotify
- updateException :: (BugsnagException -> BugsnagException) -> BeforeNotify
- filterStackFrames :: (BugsnagStackFrame -> Bool) -> BeforeNotify
- setStackFramesInProject :: (FilePath -> Bool) -> BeforeNotify
- setGroupingHash :: Text -> BeforeNotify
- setGroupingHashBy :: (BugsnagEvent -> Maybe Text) -> BeforeNotify
- updateEventFromSession :: BugsnagSession -> BeforeNotify
- updateEventFromWaiRequest :: Request -> BeforeNotify
- redactRequestHeaders :: [HeaderName] -> BeforeNotify
- setDevice :: BugsnagDevice -> BeforeNotify
- setRequest :: BugsnagRequest -> BeforeNotify
- setStacktrace :: [BugsnagStackFrame] -> BeforeNotify
- setWarningSeverity :: BeforeNotify
- setErrorSeverity :: BeforeNotify
- setInfoSeverity :: BeforeNotify
Documentation
type BeforeNotify = BugsnagEvent -> BugsnagEvent Source #
defaultBeforeNotify :: BeforeNotify Source #
Used as the default Settings valuebsBeforeNotify
Redacts the following Request headers:
- Authorization
- Cookie
- X-XSRF-TOKEN (CSRF token header used by Yesod)
N.B. If you override the value on , you probably want to
maintain this as well:BugsnagSettings
settings { bsBeforeNotify = defaultBeforeNotify . myBeforeNotify }
Modifying the Exception
updateException :: (BugsnagException -> BugsnagException) -> BeforeNotify Source #
Modify just the Exception part of an Event
Technically this will modify all exceptions in the Event, but if you're using this library normally, there will be only one.
This may be used to set more specific information for exception types in scope in your application:
notifyBugsnagWith (updateException forSqlError) settings ex
forSqlError :: BugsnagException -> BugsnagException
forSqlError ex =
case fromException =<< beOriginalException ex of
Just SqlError{..} -> ex
{ beErrorClass = "SqlError-" <> sqlErrorCode
, beMessage = Just sqlErrorMessage
}
_ -> exfilterStackFrames :: (BugsnagStackFrame -> Bool) -> BeforeNotify Source #
Filter out StackFrames matching a predicate
setStackFramesInProject :: (FilePath -> Bool) -> BeforeNotify Source #
Set using the given predicate, applied to the FilenamebsIsInProject
setGroupingHash :: Text -> BeforeNotify Source #
Set beGroupingHash
setGroupingHashBy :: (BugsnagEvent -> Maybe Text) -> BeforeNotify Source #
Set based on the EventbeGroupingHash
Modifying the Event
updateEventFromSession :: BugsnagSession -> BeforeNotify Source #
Update the Event's Context and User from the Session
updateEventFromWaiRequest :: Request -> BeforeNotify Source #
Set the events and BugsnagEventBugsnagDevice
Modifying the Request
redactRequestHeaders :: [HeaderName] -> BeforeNotify Source #
Redact the given request headers
Headers like Authorization may contain information you don't want to report
to Bugsnag.
redactRequestHeaders ["Authorization", "Cookie"]
Simple setters
setDevice :: BugsnagDevice -> BeforeNotify Source #
Set the Event's Device
setRequest :: BugsnagRequest -> BeforeNotify Source #
Set the Event's Request
setStacktrace :: [BugsnagStackFrame] -> BeforeNotify Source #
Set the stacktrace on the reported exception
notifyBugsnagWith (setStacktrace [$(currentStackFrame) "myFunc"]) ...
Setting severity
setWarningSeverity :: BeforeNotify Source #
Set to WarningSeverity
setErrorSeverity :: BeforeNotify Source #
Set to ErrorSeverity
setInfoSeverity :: BeforeNotify Source #
Set to InfoSeverity