Error interceptor

Error interceptor can obscure sensitive data from any recorded errors.

Error events can be completely omitted by returning false from the interceptor.

Example error interceptor

{
  interceptors: {
    error: (data, context) => {
      if (context.pageUrl.includes('/profile')) {
        // do not record any errors from `/profile` page
        return false;
      }
      
      if (data.message?.startsWith('Failed to load')) {
        // Do not record resource failed to load error,
        // i.e. for example when img fails to load due to some network error
        // See more at:
        //	https://developer.mozilla.org/en-US/docs/Web/API/Element/error_event
        return false;
      }
    }
}

Parameters

ParameterTypeDescription
dataobject
data.messagestringHuman-readable description of the error
data.filenamestring | undefinedPath to the file that raised the error
data.colnonumber | undefinedColumn number in the line of the file that raised the error
data.linenonumber | undefinedLine number in the file that raised the error
data.stackstring | undefinedTrace of which functions were called, in what order, from which line and file, and with what arguments
data.urlstringURL of the page where the error happened
contextErrorEvent | PromiseRejectionEvent | Error | stringType can be one of ErrorEvent, PromiseRejectionEvent, Error, or string if using Error API