Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type BeforeNotify = BugsnagEvent -> BugsnagEvent
- updateException :: (BugsnagException -> BugsnagException) -> BeforeNotify
- updateStackFrames :: (BugsnagStackFrame -> BugsnagStackFrame) -> BeforeNotify
- filterStackFrames :: (BugsnagStackFrame -> Bool) -> BeforeNotify
- setStackFramesCode :: CodeIndex -> BeforeNotify
- setStackFramesInProject :: (FilePath -> Bool) -> BeforeNotify
- setStackFramesInProjectBy :: (BugsnagStackFrame -> a) -> (a -> Bool) -> BeforeNotify
- setGroupingHash :: Text -> BeforeNotify
- setGroupingHashBy :: (BugsnagEvent -> Maybe Text) -> BeforeNotify
- updateEventFromException :: (BugsnagException -> BeforeNotify) -> BeforeNotify
- updateEventFromOriginalException :: Exception e => (e -> BeforeNotify) -> BeforeNotify
- updateEventFromSession :: BugsnagSession -> BeforeNotify
- updateEventFromWaiRequest :: Request -> BeforeNotify
- updateEventFromWaiRequestUnredacted :: 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 #
Modifying the Exception
updateException :: (BugsnagException -> BugsnagException) -> BeforeNotify Source #
Modify just the Exception part of an Event
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 } _ -> ex
updateStackFrames :: (BugsnagStackFrame -> BugsnagStackFrame) -> BeforeNotify Source #
Apply a function to each
in the ExceptionBugsnagStackFrame
filterStackFrames :: (BugsnagStackFrame -> Bool) -> BeforeNotify Source #
Filter out StackFrames matching a predicate
setStackFramesCode :: CodeIndex -> BeforeNotify Source #
Set
using the given indexbsfCode
setStackFramesInProject :: (FilePath -> Bool) -> BeforeNotify Source #
Set
using the given predicate, applied to the FilenamebsIsInProject
setStackFramesInProjectBy :: (BugsnagStackFrame -> a) -> (a -> Bool) -> BeforeNotify Source #
setGroupingHash :: Text -> BeforeNotify Source #
Set beGroupingHash
setGroupingHashBy :: (BugsnagEvent -> Maybe Text) -> BeforeNotify Source #
Set
based on the EventbeGroupingHash
Modifying the Event
updateEventFromException :: (BugsnagException -> BeforeNotify) -> BeforeNotify Source #
Update the
based on its BugsnagEvent
BugsnagException
Use this instead of
if you want to do other things to the
Event, such as set its updateException
based on the Exception.beGroupingHash
updateEventFromOriginalException :: Exception e => (e -> BeforeNotify) -> BeforeNotify Source #
Update the
based on the original exceptionBugsnagEvent
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
, you can (and should) use other
helpers:BeforeNotify
myBeforeNotify =defaultBeforeNotify
.updateEventFromOriginalException
asSqlError .updateEventFromOriginalException
asHttpError . -- ... asSqlError :: SqlError -> BeforeNotify asSqlError SqlError{..} =setGroupingHash
sqlErrorCode .updateException
$ ex -> ex { beErrorClass = sqlErrorCode , beMessage = sqlErrorMessage }
If there is no original exception, or the cast fails, the event is unchanged.
updateEventFromSession :: BugsnagSession -> BeforeNotify Source #
Update the Event's Context and User from the Session
updateEventFromWaiRequest :: Request -> BeforeNotify Source #
Set the events
and BugsnagEvent
BugsnagDevice
This function redacts the following Request headers:
- Authorization
- Cookie
- X-XSRF-TOKEN (CSRF token header used by Yesod)
To avoid this, use
.updateEventFromWaiRequestUnredacted
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