bugsnag-haskell-0.0.1.3: Bugsnag error reporter for Haskell

Safe HaskellNone
LanguageHaskell2010

Network.Bugsnag.BeforeNotify

Contents

Synopsis

Documentation

defaultBeforeNotify :: BeforeNotify Source #

Used as bsBeforeNotify the default Settings value

Redacts the following Request headers:

  • Authorization
  • Cookie
  • X-XSRF-TOKEN (CSRF token header used by Yesod)

N.B. If you override the value on BugsnagSettings, you probably want to maintain this as well:

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
            }
        _ -> ex

filterStackFrames :: (BugsnagStackFrame -> Bool) -> BeforeNotify Source #

Filter out StackFrames matching a predicate

setStackFramesInProject :: (FilePath -> Bool) -> BeforeNotify Source #

Set bsIsInProject using the given predicate, applied to the Filename

Modifying the Event

updateEventFromSession :: BugsnagSession -> BeforeNotify Source #

Update the Event's Context and User from the Session

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

setStacktrace :: [BugsnagStackFrame] -> BeforeNotify Source #

Set the stacktrace on the reported exception

notifyBugsnagWith (setStacktrace [$(currentStackFrame) "myFunc"]) ...

Setting severity