newrelic.setErrorHandler

newrelic.setErrorHandler(error object ERROR)
Allows selective ignoring of known errors that the Browser agent captures.

Requirements

Requires New Relic Browser agent version nr-974 or higher.

Access to this feature depends on your subscription level.

Description

The newrelic.setErrorHandler API call allows selective ignoring of known errors. It takes a single error handler function, which will be called for each error the Browser agent captures. If the handler returns true, New Relic does not record the error. Otherwise the error will be processed normally.

Parameters

Parameter Description

error

object

Required. Usually will be an error object, but this can be other data types.

callback

function

Required. The callback will be called with each error, so it is not specific to one error.

Example(s)

newrelic.setErrorHandler(function (err) {
   if (shouldIgnoreError(err)) {
     return true
   } else {
     return false
   }
})